Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clients/go: Bump oasis-core to 23.0 #278

Merged
merged 3 commits into from
Mar 11, 2024
Merged

Conversation

matevz
Copy link
Member

@matevz matevz commented Feb 21, 2024

This PR:

  • Bumps clients/go to use oasis-core 23.x types.
  • removes redundant data types which are already part of the oasis-sdk/client-sdk/go
  • removes SendTransaction reimplementation
  • fixes signed query implementation
  • implements encrypted and signed eth_estimateGas calls
  • adds test for PackSignedCall()

Copy link

netlify bot commented Feb 21, 2024

Deploy Preview for oasisprotocol-sapphire-paratime canceled.

Name Link
🔨 Latest commit b615766
🔍 Latest deploy log https://app.netlify.com/sites/oasisprotocol-sapphire-paratime/deploys/65eae49b5d9c2d000834118f

@matevz matevz requested a review from peternose February 21, 2024 11:31
clients/go/compat.go Outdated Show resolved Hide resolved
@matevz matevz force-pushed the matevz/clients/go/bump-oasis-core branch 3 times, most recently from 4e2787c to de3d537 Compare February 21, 2024 11:51
clients/go/cipher.go Outdated Show resolved Hide resolved
clients/go/cipher.go Outdated Show resolved Hide resolved
clients/go/cipher_test.go Outdated Show resolved Hide resolved
clients/go/go.mod Outdated Show resolved Hide resolved
Copy link
Contributor

@aefhm aefhm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makeshift e2e script in #206

@matevz matevz force-pushed the matevz/clients/go/bump-oasis-core branch from a17c3ee to 59cdfc7 Compare February 22, 2024 14:19
clients/go/cipher.go Outdated Show resolved Hide resolved
clients/go/cipher.go Show resolved Hide resolved
clients/go/cipher.go Outdated Show resolved Hide resolved
clients/go/cipher.go Show resolved Hide resolved
clients/go/compat.go Outdated Show resolved Hide resolved
@matevz matevz force-pushed the matevz/clients/go/bump-oasis-core branch 6 times, most recently from 925c330 to 30e17d3 Compare February 27, 2024 16:56
Copy link
Member

@kostko kostko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thing still needs some refactoring.

clients/go/compat.go Show resolved Hide resolved
@kostko
Copy link
Member

kostko commented Feb 28, 2024

This current API seems confusing and error-prone. It looks like it has two hooks to manipulate transactions:

  • It can generate a TransactOpts instance with a wrapped signer that also performs encryption.
  • It then also provides a wrapped SendTransaction which performs mangling, but in this case it is already too late in the pipeline to actually return the modified transaction! So in case this second fallback (e.g. TransactOpts not properly set, instead going through SendTransaction directly) is used the transaction that has actually been sent to Sapphire cannot be retrieved by the developer. Then there is additional hacky logic to detect whether a transaction was previously mangled by the wrapped signer so that it is not wrapped again.

I think it would be better if SendTransaction was not overriden and in case you want encrypted transactions you either need to encrypt them manually or use the Transactor.

@matevz matevz force-pushed the matevz/clients/go/bump-oasis-core branch 2 times, most recently from 61b1884 to 9166cc1 Compare February 28, 2024 17:34
clients/go/README.md Outdated Show resolved Hide resolved
@matevz matevz force-pushed the matevz/clients/go/bump-oasis-core branch 6 times, most recently from 854292b to c74ef18 Compare March 1, 2024 13:03
clients/go/compat.go Outdated Show resolved Hide resolved
clients/go/compat.go Outdated Show resolved Hide resolved
clients/go/compat.go Outdated Show resolved Hide resolved
clients/go/compat.go Outdated Show resolved Hide resolved
clients/go/compat.go Outdated Show resolved Hide resolved
clients/go/compat.go Outdated Show resolved Hide resolved
@matevz matevz force-pushed the matevz/clients/go/bump-oasis-core branch from c74ef18 to f2543be Compare March 4, 2024 15:35
@matevz matevz requested a review from kostko March 4, 2024 15:47
Copy link
Member

@kostko kostko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, I think we should remove the hacky SendTransaction behavior unless there is a good reason to keep it.

@matevz matevz force-pushed the matevz/clients/go/bump-oasis-core branch 6 times, most recently from 9c7ade3 to 3115fee Compare March 5, 2024 15:16
clients/go/README.md Outdated Show resolved Hide resolved
clients/go/compat.go Outdated Show resolved Hide resolved
@matevz matevz force-pushed the matevz/clients/go/bump-oasis-core branch 4 times, most recently from 2e4eed0 to 0e5924b Compare March 7, 2024 15:33
@matevz matevz requested a review from kostko March 7, 2024 15:35
clients/go/README.md Outdated Show resolved Hide resolved
clients/go/README.md Show resolved Hide resolved
clients/go/compat.go Outdated Show resolved Hide resolved
clients/go/compat.go Outdated Show resolved Hide resolved
@matevz matevz force-pushed the matevz/clients/go/bump-oasis-core branch from 0e5924b to b615766 Compare March 8, 2024 10:12
@matevz matevz requested a review from kostko March 8, 2024 16:18
@matevz matevz merged commit c45c136 into main Mar 11, 2024
15 checks passed
@matevz matevz deleted the matevz/clients/go/bump-oasis-core branch March 11, 2024 10:51
@aefhm
Copy link
Contributor

aefhm commented Mar 12, 2024

I suppose this'll effect a minor version bump?

dataPack, err := NewDataPack(sign, chainID.Uint64(), msg.From[:], msg.To[:], 0, msg.GasPrice, msg.Value, msg.Data, leash)
func PackSignedCall(msg ethereum.CallMsg, cipher Cipher, sign SignerFn, chainID big.Int, leash *evm.Leash) (*ethereum.CallMsg, error) {
if msg.Gas == 0 {
msg.Gas = DefaultGasLimit // Must be non-zero for signed calls.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So even 1 will work right? Just confirming as we don't use DefaultGasLimit otherwise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 will "work" in the sense that it will pass signature verification, but probably won't be enough to actually run anything useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I thought this was overriding the the msg.Gas, but it is not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants