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

Upcoming Sapphire 0.6.0 allows Epoch to be specified, clients/js should support this #160

Open
CedarMist opened this issue Aug 3, 2023 · 3 comments

Comments

@CedarMist
Copy link
Member

Re: oasis-sdk/pull/1420

The callformat.rs::CallEnvelopeX25519DeoxysII struct is expanded with an optional epoch parameter.

This allows encrypted calls to specify which epoch they are encrypting a transaction for, otherwise the endpoint will try the previous 2 epochs and fail if neither match.

Additionally an epoch parameters is returned from callDataPublicKey which will need to be returned by the Web3 gateway in https://github.com/oasisprotocol/oasis-web3-gateway/blob/main/rpc/oasis/api.go

type callDataPublicKeyQueryResponse struct {
	// PublicKey is the ephemeral X25519 runtime public key.
	PublicKey types.SignedPublicKey `json:"public_key"`
	// Epoch is the epoch of the ephemeral runtime key.
	Epoch uint64 `json:"epoch,omitempty"`
}

The result from the web3 gateway can be used by the JS & Go clients when encrypting transactions.

@CedarMist
Copy link
Member Author

This will work around problems like:

 Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"from":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","to":"0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6","data":"0x74e400f900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000013a26565706f636841a4677265636569707441f300000000000000000000000000","accessList":null}, error={"name":"ProviderError","_stack":"ProviderError: invalid signed simulate call query: base block not found\n    at HttpProvider.request (/home/runner/work/sapphire-paratime/sapphire-paratime/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/hardhat/src/internal/core/providers/http.ts:88:21)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)","code":-32000,"_isProviderError":true}, code=CALL_EXCEPTION, version=providers/5.7.2)

@kostko
Copy link
Member

kostko commented Oct 17, 2023

This last error actually seems unrelated and has to do with signed queries instead.

@CedarMist
Copy link
Member Author

I'm including it in my mental bundle of tangentially related things to signed queries & calls, and handling epochs & block transitions more reliably in the client when using leashes.

https://github.com/oasisprotocol/oasis-sdk/blob/6cd241c7a71f005ce02283dcd1f3a24343abd19f/runtime-sdk/modules/evm/src/signed_call.rs#L52-L58

Not sure why it can't find the block from the block number specified in the leash, but that's something I see as related and in the line of investigation.

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

No branches or pull requests

2 participants