[pallet-revive] Update gas encoding (#6689)
Update the current approach to attach the `ref_time`, `pov` and
`deposit` parameters to an Ethereum transaction.
Previously we will pass these 3 parameters along with the signed
payload, and check that the fees resulting from `gas x gas_price` match
the actual fees paid by the user for the extrinsic.
This approach unfortunately can be attacked. A malicious actor could
force such a transaction to fail by injecting low values for some of
these extra parameters as they are not part of the signed payload.
The new approach encodes these 3 extra parameters in the lower digits of
the transaction gas, approximating the the log2 of the actual values to
encode each components on 2 digits
---------
Co-authored-by:
GitHub Action <action@github.com>
Co-authored-by: command-bot <>
parent
2f7cf417
Showing
- cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs 1 addition, 0 deletions...s/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
- prdoc/pr_6689.prdoc 19 additions, 0 deletionsprdoc/pr_6689.prdoc
- substrate/bin/node/runtime/src/lib.rs 1 addition, 0 deletionssubstrate/bin/node/runtime/src/lib.rs
- substrate/frame/revive/rpc/examples/js/bun.lockb 0 additions, 0 deletionssubstrate/frame/revive/rpc/examples/js/bun.lockb
- substrate/frame/revive/rpc/examples/js/package.json 2 additions, 2 deletionssubstrate/frame/revive/rpc/examples/js/package.json
- substrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts 0 additions, 22 deletionssubstrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts
- substrate/frame/revive/rpc/examples/js/src/piggy-bank.ts 6 additions, 9 deletionssubstrate/frame/revive/rpc/examples/js/src/piggy-bank.ts
- substrate/frame/revive/rpc/revive_chain.metadata 0 additions, 0 deletionssubstrate/frame/revive/rpc/revive_chain.metadata
- substrate/frame/revive/rpc/src/client.rs 2 additions, 2 deletionssubstrate/frame/revive/rpc/src/client.rs
- substrate/frame/revive/rpc/src/lib.rs 2 additions, 21 deletionssubstrate/frame/revive/rpc/src/lib.rs
- substrate/frame/revive/src/evm.rs 2 additions, 0 deletionssubstrate/frame/revive/src/evm.rs
- substrate/frame/revive/src/evm/api/byte.rs 4 additions, 1 deletionsubstrate/frame/revive/src/evm/api/byte.rs
- substrate/frame/revive/src/evm/gas_encoder.rs 174 additions, 0 deletionssubstrate/frame/revive/src/evm/gas_encoder.rs
- substrate/frame/revive/src/evm/runtime.rs 109 additions, 119 deletionssubstrate/frame/revive/src/evm/runtime.rs
- substrate/frame/revive/src/lib.rs 18 additions, 13 deletionssubstrate/frame/revive/src/lib.rs