diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 2f318fe89..4183e3eff 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -53,6 +53,6 @@ jobs: run: make test-coverage-integration - name: "Upload coverage reports to Codecov" - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/proto-lint.yml b/.github/workflows/proto-lint.yml index 318fcc185..73328662a 100644 --- a/.github/workflows/proto-lint.yml +++ b/.github/workflows/proto-lint.yml @@ -22,7 +22,7 @@ jobs: # timeout-minutes: 5 # steps: # - uses: actions/checkout@v4 - # - uses: bufbuild/buf-setup-action@v1.46.0 + # - uses: bufbuild/buf-setup-action@v1.47.2 # - uses: bufbuild/buf-lint-action@v1 # with: # input: "proto" @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.46.0 + - uses: bufbuild/buf-setup-action@v1.47.2 with: github_token: ${{ github.token }} - uses: bufbuild/buf-breaking-action@v1 diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..deed13c01 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +lts/jod diff --git a/CHANGELOG.md b/CHANGELOG.md index 66b6126e2..d9ab20b24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,20 +42,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Nibiru EVM -#### Nibiru EVM | Before Audit 2 [Nov, 2024] +- [#2119](https://github.com/NibiruChain/nibiru/pull/2119) - fix(evm): Guarantee +that gas consumed during any send operation of the "NibiruBankKeeper" depends +only on the "bankkeeper.BaseKeeper"'s gas consumption. +- [#2120](https://github.com/NibiruChain/nibiru/pull/2120) - fix: Use canonical hexadecimal strings for Eip155 address encoding +- [#2122](https://github.com/NibiruChain/nibiru/pull/2122) - test(evm): more bank extension tests and EVM ABCI integration tests to prevent regressions +- [#2124](https://github.com/NibiruChain/nibiru/pull/2124) - refactor(evm): +Remove unnecessary argument in the `VerifyFee` function, which returns the token +payment required based on the effective fee from the tx data. Improve +documentation. +- [#2125](https://github.com/NibiruChain/nibiru/pull/2125) - feat(evm-precompile):Emit EVM events created to reflect the ABCI events that occur outside the EVM to make sure that block explorers and indexers can find indexed ABCI event information. +- [#2129](https://github.com/NibiruChain/nibiru/pull/2129) - fix(evm): issue with infinite recursion in erc20 funtoken contracts +- [#2134](https://github.com/NibiruChain/nibiru/pull/2134) - fix(evm): query of NIBI should use bank state, not the StateDB + +#### Nibiru EVM | Before Audit 2 - 2024-12-06 The codebase went through a third-party [Code4rena Zenith](https://code4rena.com/zenith) Audit, running from 2024-10-07 until 2024-11-01 and including both a primary review period and mitigation/remission -period. This section describes code changes that occured after that audit in +period. This section describes code changes that occurred after that audit in preparation for a second audit starting in November 2024. - [#2074](https://github.com/NibiruChain/nibiru/pull/2074) - fix(evm-keeper): better utilize ERC20 metadata during FunToken creation. The bank metadata for a new FunToken mapping ties a connection between the Bank Coin's `DenomUnit` and the ERC20 contract metadata like the name, decimals, and symbol. This change brings parity between EVM wallets, such as MetaMask, and Interchain wallets like Keplr and Leap. - [#2076](https://github.com/NibiruChain/nibiru/pull/2076) - fix(evm-gas-fees): Use effective gas price in RefundGas and make sure that units are properly - reflected on all occurences of "base fee" in the codebase. This fixes [#2059](https://github.com/NibiruChain/nibiru/issues/2059) + reflected on all occurrences of "base fee" in the codebase. This fixes [#2059](https://github.com/NibiruChain/nibiru/issues/2059) and the [related comments from @Unique-Divine and @berndartmueller](https://github.com/NibiruChain/nibiru/issues/2059#issuecomment-2408625724). -- [#2084](https://github.com/NibiruChain/nibiru/pull/2084) - feat(evm-forge): foundry support and template for Nibiru EVM develoment +- [#2084](https://github.com/NibiruChain/nibiru/pull/2084) - feat(evm-forge): foundry support and template for Nibiru EVM development - [#2086](https://github.com/NibiruChain/nibiru/pull/2086) - fix(evm-precomples): Fix state consistency in precompile execution by ensuring proper journaling of state changes in the StateDB. This pull request makes sure that state is @@ -106,12 +119,18 @@ about the expected resulting balance for the transfer recipient. - [#2101](https://github.com/NibiruChain/nibiru/pull/2101) - fix(evm): tx receipt proper marshalling - [#2105](https://github.com/NibiruChain/nibiru/pull/2105) - test(evm): precompile call with revert - [#2106](https://github.com/NibiruChain/nibiru/pull/2106) - chore: scheduled basic e2e tests for evm testnet endpoint -- [#2107](https://github.com/NibiruChain/nibiru/pull/2107) - -feat(evm-funtoken-precompile): Implement methods: balance, bankBalance, whoAmI +- [#2107](https://github.com/NibiruChain/nibiru/pull/2107) - feat(evm-funtoken-precompile): Implement methods: balance, bankBalance, whoAmI - [#2108](https://github.com/NibiruChain/nibiru/pull/2108) - fix(evm): removed deprecated root key from eth_getTransactionReceipt - [#2110](https://github.com/NibiruChain/nibiru/pull/2110) - fix(evm): Restore StateDB to its state prior to ApplyEvmMsg call to ensure deterministic gas usage. This fixes an issue where the StateDB pointer field in NibiruBankKeeper was being updated during readonly query endpoints like eth_estimateGas, leading to non-deterministic gas usage in subsequent transactions. - [#2111](https://github.com/NibiruChain/nibiru/pull/2111) - fix: e2e-evm-cron.yml - [#2114](https://github.com/NibiruChain/nibiru/pull/2114) - fix(evm): make gas cost zero in conditional bank keeper flow +- [#2116](https://github.com/NibiruChain/nibiru/pull/2116) - fix(precompile-funtoken.go): Fixes a bug where the err != nil check is missing in the bankBalance precompile method +- [#2117](https://github.com/NibiruChain/nibiru/pull/2117) - fix(oracle): The +timestamps resulting from ctx.WithBlock* don't actually correspond to the block +header information from specified blocks in the chain's history, so the oracle +exchange rates need a way to correctly retrieve this information. This change +fixes that discrepancy, giving the expected block timestamp for the EVM's oracle +precompiled contract. The change also simplifies and corrects the code in x/oracle. #### Nibiru EVM | Before Audit 1 - 2024-10-18 @@ -237,11 +256,11 @@ feat(evm-funtoken-precompile): Implement methods: balance, bankBalance, whoAmI - Bump `github.com/grpc-ecosystem/grpc-gateway/v2` from 2.18.1 to 2.19.1 ([#1767](https://github.com/NibiruChain/nibiru/pull/1767), [#1782](https://github.com/NibiruChain/nibiru/pull/1782)) - Bump `robinraju/release-downloader` from 1.8 to 1.11 ([#1783](https://github.com/NibiruChain/nibiru/pull/1783), [#1839](https://github.com/NibiruChain/nibiru/pull/1839), [#1948](https://github.com/NibiruChain/nibiru/pull/1948)) - Bump `github.com/prometheus/client_golang` from 1.17.0 to 1.18.0 ([#1750](https://github.com/NibiruChain/nibiru/pull/1750)) -- Bump `golang.org/x/crypto` from 0.15.0 to 0.17.0 ([#1724](https://github.com/NibiruChain/nibiru/pull/1724), [#1843](https://github.com/NibiruChain/nibiru/pull/1843)) +- Bump `golang.org/x/crypto` from 0.15.0 to 0.31.0 ([#1724](https://github.com/NibiruChain/nibiru/pull/1724), [#1843](https://github.com/NibiruChain/nibiru/pull/1843), [#2123](https://github.com/NibiruChain/nibiru/pull/2123)) - Bump `github.com/holiman/uint256` from 1.2.3 to 1.2.4 ([#1730](https://github.com/NibiruChain/nibiru/pull/1730)) - Bump `github.com/dvsekhvalnov/jose2go` from 1.5.0 to 1.6.0 ([#1733](https://github.com/NibiruChain/nibiru/pull/1733)) - Bump `github.com/spf13/cast` from 1.5.1 to 1.6.0 ([#1689](https://github.com/NibiruChain/nibiru/pull/1689)) -- Bump `cosmossdk.io/math` from 1.1.2 to 1.2.0 ([#1676](https://github.com/NibiruChain/nibiru/pull/1676)) +- Bump `cosmossdk.io/math` from 1.1.2 to 1.4.0 ([#1676](https://github.com/NibiruChain/nibiru/pull/1676), [#2115](https://github.com/NibiruChain/nibiru/pull/2115)) - Bump `github.com/grpc-ecosystem/grpc-gateway/v2` from 2.18.0 to 2.18.1 ([#1675](https://github.com/NibiruChain/nibiru/pull/1675)) - Bump `actions/setup-go` from 4 to 5 ([#1696](https://github.com/NibiruChain/nibiru/pull/1696)) - Bump `golang` from 1.19 to 1.21 ([#1698](https://github.com/NibiruChain/nibiru/pull/1698)) @@ -253,10 +272,11 @@ feat(evm-funtoken-precompile): Implement methods: balance, bankBalance, whoAmI - Bump `github.com/hashicorp/go-getter` from 1.7.1 to 1.7.5 ([#1858](https://github.com/NibiruChain/nibiru/pull/1858), [#1938](https://github.com/NibiruChain/nibiru/pull/1938)) - Bump `github.com/btcsuite/btcd` from 0.23.3 to 0.24.2 ([#1862](https://github.com/NibiruChain/nibiru/pull/1862), [#2070](https://github.com/NibiruChain/nibiru/pull/2070)) - Bump `pozetroninc/github-action-get-latest-release` from 0.7.0 to 0.8.0 ([#1863](https://github.com/NibiruChain/nibiru/pull/1863)) -- Bump `bufbuild/buf-setup-action` from 1.30.1 to 1.46.0 ([#1891](https://github.com/NibiruChain/nibiru/pull/1891), [#1900](https://github.com/NibiruChain/nibiru/pull/1900), [#1923](https://github.com/NibiruChain/nibiru/pull/1923), [#1972](https://github.com/NibiruChain/nibiru/pull/1972), [#1974](https://github.com/NibiruChain/nibiru/pull/1974), [#1988](https://github.com/NibiruChain/nibiru/pull/1988), [#2043](https://github.com/NibiruChain/nibiru/pull/2043), [#2057](https://github.com/NibiruChain/nibiru/pull/2057), [#2062](https://github.com/NibiruChain/nibiru/pull/2062), [#2069](https://github.com/NibiruChain/nibiru/pull/2069), [#2102](https://github.com/NibiruChain/nibiru/pull/2102)) +- Bump `bufbuild/buf-setup-action` from 1.30.1 to 1.47.2 ([#1891](https://github.com/NibiruChain/nibiru/pull/1891), [#1900](https://github.com/NibiruChain/nibiru/pull/1900), [#1923](https://github.com/NibiruChain/nibiru/pull/1923), [#1972](https://github.com/NibiruChain/nibiru/pull/1972), [#1974](https://github.com/NibiruChain/nibiru/pull/1974), [#1988](https://github.com/NibiruChain/nibiru/pull/1988), [#2043](https://github.com/NibiruChain/nibiru/pull/2043), [#2057](https://github.com/NibiruChain/nibiru/pull/2057), [#2062](https://github.com/NibiruChain/nibiru/pull/2062), [#2069](https://github.com/NibiruChain/nibiru/pull/2069), [#2102](https://github.com/NibiruChain/nibiru/pull/2102), [#2113](https://github.com/NibiruChain/nibiru/pull/2113)) - Bump `axios` from 1.7.3 to 1.7.4 ([#2016](https://github.com/NibiruChain/nibiru/pull/2016)) - Bump `github.com/CosmWasm/wasmvm` from 1.5.0 to 1.5.5 ([#2047](https://github.com/NibiruChain/nibiru/pull/2047)) - Bump `docker/build-push-action` from 5 to 6 ([#1924](https://github.com/NibiruChain/nibiru/pull/1924)) +- Bump `codecov/codecov-action` from 4 to 5 ([#2112](https://github.com/NibiruChain/nibiru/pull/2112)) ## [v1.5.0](https://github.com/NibiruChain/nibiru/releases/tag/v1.5.0) - 2024-06-21 diff --git a/app/ante/commission_test.go b/app/ante/commission_test.go index 9cbd18982..fd4d6ca50 100644 --- a/app/ante/commission_test.go +++ b/app/ante/commission_test.go @@ -1,8 +1,6 @@ package ante_test import ( - "testing" - "cosmossdk.io/math" sdkclienttx "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" @@ -109,7 +107,7 @@ func (s *AnteTestSuite) TestAnteDecoratorStakingCommission() { wantErr: ante.ErrMaxValidatorCommission.Error(), }, } { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { txGasCoins := sdk.NewCoins( sdk.NewCoin("unibi", math.NewInt(1_000)), sdk.NewCoin("utoken", math.NewInt(500)), diff --git a/app/ante/fixed_gas_test.go b/app/ante/fixed_gas_test.go index 0d11b3b2d..4e45f6b6b 100644 --- a/app/ante/fixed_gas_test.go +++ b/app/ante/fixed_gas_test.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/signing" - "github.com/cosmos/cosmos-sdk/x/bank/types" + bank "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/NibiruChain/nibiru/v2/app/ante" "github.com/NibiruChain/nibiru/v2/app/appconst" @@ -62,7 +62,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { Feeder: addr.String(), Validator: addr.String(), }, - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), @@ -74,7 +74,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { { name: "Two messages in a transaction, one of them is an oracle vote message should fail (with MsgAggregateExchangeRatePrevote) permutation 2", messages: []sdk.Msg{ - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), @@ -97,7 +97,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { Feeder: addr.String(), Validator: addr.String(), }, - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), @@ -109,7 +109,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { { name: "Two messages in a transaction, one of them is an oracle vote message should fail (with MsgAggregateExchangeRateVote) permutation 2", messages: []sdk.Msg{ - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), @@ -169,7 +169,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { Feeder: addr.String(), Validator: addr.String(), }, - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), @@ -186,25 +186,25 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { { name: "Other two messages", messages: []sdk.Msg{ - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), }, - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 200)), }, }, - expectedGas: 67193, + expectedGas: 38175, expectedErr: nil, }, } for _, tc := range tests { tc := tc - suite.T().Run(tc.name, func(t *testing.T) { + suite.Run(tc.name, func() { suite.SetupTest() // setup suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() diff --git a/app/evmante/evmante_gas_consume.go b/app/evmante/evmante_gas_consume.go index 527d6fdaf..01d39668e 100644 --- a/app/evmante/evmante_gas_consume.go +++ b/app/evmante/evmante_gas_consume.go @@ -99,7 +99,6 @@ func (anteDec AnteDecEthGasConsume) AnteHandle( fees, err := keeper.VerifyFee( txData, - evm.EVMBankDenom, baseFeeMicronibiPerGas, ctx.IsCheckTx(), ) diff --git a/app/evmante/suite_test.go b/app/evmante/suite_test.go index 2150aebe3..621778582 100644 --- a/app/evmante/suite_test.go +++ b/app/evmante/suite_test.go @@ -60,7 +60,7 @@ func (s *TestSuite) TestGenesis() { wantErr: "min_commission must be positive", }, } { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { genStakingJson := s.encCfg.Codec.MustMarshalJSON(tc.gen) err := app.StakingModule{}.ValidateGenesis( s.encCfg.Codec, diff --git a/app/modules_test.go b/app/modules_test.go index 5abd63267..44e59599f 100644 --- a/app/modules_test.go +++ b/app/modules_test.go @@ -60,7 +60,7 @@ func (s *TestSuite) TestGenesis() { wantErr: "min_commission must be positive", }, } { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { genStakingJson := s.encCfg.Codec.MustMarshalJSON(tc.gen) err := app.StakingModule{}.ValidateGenesis( s.encCfg.Codec, diff --git a/app/wasmext/stargate_query.go b/app/wasmext/stargate_query.go index bd1567175..2d90b6d58 100644 --- a/app/wasmext/stargate_query.go +++ b/app/wasmext/stargate_query.go @@ -120,7 +120,6 @@ func WasmAcceptedStargateQueries() wasmkeeper.AcceptedStargateQueries { // nibiru oracle "/nibiru.oracle.v1.Query/ExchangeRate": new(oracle.QueryExchangeRateResponse), - "/nibiru.oracle.v1.Query/DatedExchangeRate": new(oracle.QueryDatedExchangeRateResponse), "/nibiru.oracle.v1.Query/ExchangeRateTwap": new(oracle.QueryExchangeRateResponse), "/nibiru.oracle.v1.Query/ExchangeRates": new(oracle.QueryExchangeRatesResponse), "/nibiru.oracle.v1.Query/Actives": new(oracle.QueryActivesResponse), diff --git a/contrib/bashlib.sh b/contrib/bashlib.sh index 2279cc456..98c68d899 100644 --- a/contrib/bashlib.sh +++ b/contrib/bashlib.sh @@ -29,26 +29,26 @@ export COLOR_BRIGHT_WHITE="\033[97m" # log_debug: Simple wrapper for `echo` with a DEBUG prefix. log_debug() { - echo "${COLOR_CYAN}DEBUG${COLOR_RESET}" "$@" + echo -e "${COLOR_CYAN}DEBUG${COLOR_RESET}" "$@" } # log_error: ERROR messages in red, output to stderr. log_error() { - echo "❌ ${COLOR_RED}ERROR:${COLOR_RESET}" "$@" >&2 + echo -e "❌ ${COLOR_RED}ERROR:${COLOR_RESET}" "$@" >&2 } log_success() { - echo "${COLOR_GREEN}✅ SUCCESS:${COLOR_RESET}" "$@" + echo -e "${COLOR_GREEN}✅ SUCCESS:${COLOR_RESET}" "$@" } # log_warning: WARNING messages represent non-critical issues that might not # require immediate action but should be noted as points of concern or failure. log_warning() { - echo "${COLOR_YELLOW}WARNING${COLOR_RESET}" "$@" >&2 + echo -e "${COLOR_YELLOW}WARNING${COLOR_RESET}" "$@" >&2 } log_info() { - echo "${COLOR_MAGENTA}INFO${COLOR_RESET}" "$@" + echo -e "${COLOR_MAGENTA}INFO${COLOR_RESET}" "$@" } # ————————————————————————————————————————————————— diff --git a/eth/eip55.go b/eth/eip55.go index 5a47664b9..b4e66a4d0 100644 --- a/eth/eip55.go +++ b/eth/eip55.go @@ -1,7 +1,6 @@ package eth import ( - "encoding/json" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -36,14 +35,14 @@ func NewEIP55AddrFromStr(input string) (EIP55Addr, error) { // Marshal implements the gogo proto custom type interface. // Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md func (h EIP55Addr) Marshal() ([]byte, error) { - return h.Bytes(), nil + return []byte(h.Address.Hex()), nil } // MarshalJSON returns the [EIP55Addr] as JSON bytes. // Implements the gogo proto custom type interface. // Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md func (h EIP55Addr) MarshalJSON() ([]byte, error) { - return json.Marshal(h.String()) + return []byte(h.String()), nil } // MarshalTo serializes a EIP55Addr directly into a pre-allocated byte slice ("data"). @@ -51,38 +50,34 @@ func (h EIP55Addr) MarshalJSON() ([]byte, error) { // Implements the gogo proto custom type interface. // Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md func (h *EIP55Addr) MarshalTo(data []byte) (n int, err error) { - copy(data, h.Bytes()) + copy(data, []byte(h.Address.Hex())) return h.Size(), nil } // Unmarshal implements the gogo proto custom type interface. // Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md func (h *EIP55Addr) Unmarshal(data []byte) error { - addr := gethcommon.BytesToAddress(data) - *h = EIP55Addr{Address: addr} + addr, err := NewEIP55AddrFromStr(string(data)) + if err != nil { + return err + } + *h = addr return nil } // UnmarshalJSON implements the gogo proto custom type interface. // Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md func (h *EIP55Addr) UnmarshalJSON(bz []byte) error { - text := new(string) - if err := json.Unmarshal(bz, text); err != nil { - return err - } - - addr, err := NewEIP55AddrFromStr(*text) + addr, err := NewEIP55AddrFromStr(string(bz)) if err != nil { return err } - *h = addr - return nil } // Size implements the gogo proto custom type interface. // Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md func (h EIP55Addr) Size() int { - return len(h.Bytes()) + return len([]byte(h.Address.Hex())) } diff --git a/eth/eip55_test.go b/eth/eip55_test.go index c0f1b9de4..d927d9447 100644 --- a/eth/eip55_test.go +++ b/eth/eip55_test.go @@ -116,15 +116,15 @@ func (s *EIP55AddrSuite) TestProtobufEncoding() { }{ { input: threeValidAddrs[0], - expectedJson: "\"0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed\"", + expectedJson: "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", }, { input: threeValidAddrs[1], - expectedJson: "\"0xAe967917c465db8578ca9024c205720b1a3651A9\"", + expectedJson: "0xAe967917c465db8578ca9024c205720b1a3651A9", }, { input: threeValidAddrs[2], - expectedJson: "\"0x1111111111111111111112222222222223333323\"", + expectedJson: "0x1111111111111111111112222222222223333323", }, } { s.Run(strconv.Itoa(tcIdx), func() { @@ -140,7 +140,7 @@ func (s *EIP55AddrSuite) TestProtobufEncoding() { bz, err := tc.input.Marshal() s.NoError(err) - s.Equal(tc.input.Bytes(), bz, + s.Equal(tc.expectedJson, string(bz), "Marshaling to bytes gives different value than the test case specifies. test case #%d", tcIdx) err = eip55Addr.Unmarshal(bz) @@ -148,7 +148,8 @@ func (s *EIP55AddrSuite) TestProtobufEncoding() { s.Equal(tc.input.Address, eip55Addr.Address, "Given -> Marshal -> Unmarshal returns a different value than the given when it should be an identity operation (no-op). test case #%d", tcIdx) - s.Equal(len(tc.input.Bytes()), tc.input.Size()) + s.Equal(len([]byte(tc.input.Hex())), tc.input.Size()) + s.Equal(len(tc.input.Hex()), tc.input.Size()) }) } } @@ -173,3 +174,24 @@ type EIP55AddrSuite struct { func TestEIP55AddrSuite(t *testing.T) { suite.Run(t, new(EIP55AddrSuite)) } + +func (s *EIP55AddrSuite) TestStringEncoding() { + addrHex := "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed" + addr := new(eth.EIP55Addr) + err := addr.Unmarshal([]byte(addrHex)) + s.NoError(err) + s.Equal(addrHex, addr.Address.Hex()) + + addrBytes, err := addr.Marshal() + s.NoError(err) + s.Equal(addrHex, string(addrBytes)) + + bz, err := addr.MarshalJSON() + s.NoError(err) + s.Equal(addrHex, string(bz)) + + addrb := new(eth.EIP55Addr) + err = addrb.UnmarshalJSON([]byte(addrHex)) + s.NoError(err) + s.EqualValues(addrb, addr) +} diff --git a/eth/rpc/backend/account_info.go b/eth/rpc/backend/account_info.go index 2a5de9245..a0c0caceb 100644 --- a/eth/rpc/backend/account_info.go +++ b/eth/rpc/backend/account_info.go @@ -83,7 +83,11 @@ func (b *Backend) GetProof( for i, key := range storageKeys { hexKey := gethcommon.HexToHash(key) - valueBz, proof, err := b.queryClient.GetProof(clientCtx, evm.StoreKey, evm.StateKey(address, hexKey.Bytes())) + valueBz, proof, err := b.queryClient.GetProof( + clientCtx, + evm.StoreKey, + evm.StateKey(address, hexKey.Bytes()), + ) if err != nil { return nil, err } diff --git a/eth/rpc/backend/blocks_test.go b/eth/rpc/backend/blocks_test.go index 4bb5d6511..918bb8794 100644 --- a/eth/rpc/backend/blocks_test.go +++ b/eth/rpc/backend/blocks_test.go @@ -16,7 +16,9 @@ func (s *BackendSuite) TestBlockNumber() { latestHeight, _ := s.network.LatestHeight() resp, err := s.backend.BlockNumber() s.Require().NoError(err, resp) - s.Require().Equal(uint64(latestHeight), uint64(blockHeight)) + // Rather than checking exact equality, which might not be true due to + // latency. Add a cushion of 2 blocks. + s.Require().LessOrEqual(uint64(latestHeight)-uint64(blockHeight), uint64(2)) } func (s *BackendSuite) TestGetBlockByNumberr() { diff --git a/eth/rpc/block_test.go b/eth/rpc/block_test.go index fde99b14c..1fd502272 100644 --- a/eth/rpc/block_test.go +++ b/eth/rpc/block_test.go @@ -7,6 +7,7 @@ import ( grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" "github.com/ethereum/go-ethereum/common" + "github.com/rs/zerolog/log" "github.com/stretchr/testify/suite" "google.golang.org/grpc/metadata" ) @@ -129,7 +130,7 @@ func (s *BlockSuite) TestUnmarshalBlockNumberOrHash() { } for _, tc := range testCases { - fmt.Printf("Case %s", tc.msg) + log.Info().Msgf("Case %s", tc.msg) // reset input bnh = new(BlockNumberOrHash) err := bnh.UnmarshalJSON(tc.input) diff --git a/evm-e2e/justfile b/evm-e2e/justfile index ce1a88523..396488f58 100644 --- a/evm-e2e/justfile +++ b/evm-e2e/justfile @@ -23,3 +23,6 @@ test-basic: # Format fmt: npm run format + +gen-types: + npx hardhat typechain diff --git a/go.mod b/go.mod index 212c99e6b..0d5688fe2 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( require ( cosmossdk.io/api v0.7.0 // indirect cosmossdk.io/errors v1.0.1 - cosmossdk.io/math v1.3.0 + cosmossdk.io/math v1.4.0 cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d github.com/MakeNowJust/heredoc/v2 v2.0.1 github.com/armon/go-metrics v0.4.1 @@ -60,11 +60,12 @@ require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc github.com/gorilla/websocket v1.5.0 github.com/rs/cors v1.8.3 + github.com/rs/zerolog v1.32.0 github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 - golang.org/x/crypto v0.21.0 + golang.org/x/crypto v0.31.0 golang.org/x/exp v0.0.0-20231006140011-7918f672742d golang.org/x/net v0.23.0 - golang.org/x/text v0.14.0 + golang.org/x/text v0.21.0 ) require ( @@ -196,7 +197,6 @@ require ( github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/rs/zerolog v1.32.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect @@ -225,9 +225,9 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/term v0.18.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/term v0.27.0 // indirect golang.org/x/time v0.5.0 // indirect google.golang.org/api v0.155.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/go.sum b/go.sum index ab3cd42aa..d3fe3717d 100644 --- a/go.sum +++ b/go.sum @@ -200,8 +200,8 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= -cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= -cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= +cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ= +cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk= cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d h1:E/8y0oG3u9hBR8l4F9MtC0LdZIamPCUwUoLlrHrX86I= cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d/go.mod h1:xbjky3L3DJEylaho6gXplkrMvJ5sFgv+qNX+Nn47bzY= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= @@ -1350,8 +1350,9 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= @@ -1378,8 +1379,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1489,8 +1490,8 @@ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1596,8 +1597,9 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1605,8 +1607,9 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1620,8 +1623,9 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1690,8 +1694,8 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/justfile b/justfile index bfdd90458..77b6e1aaf 100644 --- a/justfile +++ b/justfile @@ -20,17 +20,29 @@ build: clean-cache: go clean -cache -testcache -modcache -alias b := build - -# Generate protobuf code (Golang) for Nibiru +# Generate protobuf-based types in Golang proto-gen: #!/usr/bin/env bash make proto-gen -alias proto := proto-gen +# Generate Solidity artifacts for x/evm/embeds +gen-embeds: + #!/usr/bin/env bash + source contrib/bashlib.sh + + embeds_dir="x/evm/embeds" + log_info "Begin to compile Solidity in $embeds_dir" + which_ok npm + log_info "Using system node version: $(npm exec -- node -v)" + + cd "$embeds_dir" || (log_error "path $embeds_dir not found" && exit) + npx hardhat compile + log_success "Compiled Solidity in $embeds_dir" + +alias gen-proto := proto-gen -# Build protobuf types (Rust) -proto-rs: +# Generate protobuf-based types in Rust +gen-proto-rs: bash proto/buf.gen.rs.sh lint: diff --git a/proto/nibiru/oracle/v1/oracle.proto b/proto/nibiru/oracle/v1/oracle.proto index 6978d3bc7..76378ff90 100644 --- a/proto/nibiru/oracle/v1/oracle.proto +++ b/proto/nibiru/oracle/v1/oracle.proto @@ -130,7 +130,7 @@ message ExchangeRateTuple { ]; } -message DatedPrice { +message ExchangeRateAtBlock { string exchange_rate = 1 [ (gogoproto.moretags) = "yaml:\"exchange_rate\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -138,6 +138,11 @@ message DatedPrice { ]; uint64 created_block = 2 [ (gogoproto.moretags) = "yaml:\"created_block\"" ]; + + // Block timestamp for the block where the oracle came to consensus for this + // price. This timestamp is a conventional Unix millisecond time, i.e. the + // number of milliseconds elapsed since January 1, 1970 UTC. + int64 block_timestamp_ms = 3 [ (gogoproto.moretags) = "yaml:\"block_timestamp_ms\"" ]; } // Rewards defines a credit object towards validators diff --git a/proto/nibiru/oracle/v1/query.proto b/proto/nibiru/oracle/v1/query.proto index 3be464a1a..925042721 100644 --- a/proto/nibiru/oracle/v1/query.proto +++ b/proto/nibiru/oracle/v1/query.proto @@ -10,7 +10,8 @@ option go_package = "github.com/NibiruChain/nibiru/v2/x/oracle/types"; // Query defines the gRPC querier service. service Query { - // ExchangeRate returns exchange rate of a pair + // ExchangeRate returns exchange rate of a pair along with the block height and + // block time that the exchange rate was set by the oracle module. rpc ExchangeRate(QueryExchangeRateRequest) returns (QueryExchangeRateResponse) { option (google.api.http).get = "/nibiru/oracle/v1beta1/exchange_rate"; @@ -22,12 +23,6 @@ service Query { option (google.api.http).get = "/nibiru/oracle/v1beta1/exchange_rate_twap"; } - // DatedExchangeRate returns latest price of a pair - rpc DatedExchangeRate(QueryExchangeRateRequest) - returns (QueryDatedExchangeRateResponse) { - option (google.api.http).get = "/nibiru/oracle/v1beta1/dated_exchange_rate"; - } - // ExchangeRates returns exchange rates of all pairs rpc ExchangeRates(QueryExchangeRatesRequest) returns (QueryExchangeRatesResponse) { @@ -114,20 +109,6 @@ message QueryExchangeRateResponse { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; -} - -// QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC -// method. -message QueryExchangeRatesRequest { -} - -// QueryDatedExchangeRateResponse is the request type for the -// Query/DatedExchangeRate RPC method. -message QueryDatedExchangeRateResponse { - string price = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; // Block timestamp for the block where the oracle came to consensus for this // price. This timestamp is a conventional Unix millisecond time, i.e. the @@ -138,6 +119,11 @@ message QueryDatedExchangeRateResponse { uint64 block_height = 3; } +// QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC +// method. +message QueryExchangeRatesRequest { +} + // QueryExchangeRatesResponse is response type for the // Query/ExchangeRates RPC method. message QueryExchangeRatesResponse { diff --git "a/security-reports/2023-05-Nibiru-Salus-Penetration-Testing-Report-V2-\350\204\261\346\225\217.pdf" "b/security-reports/2023-05-Nibiru-Salus-Penetration-Testing-Report-V2-\350\204\261\346\225\217.pdf" new file mode 100644 index 000000000..d50d1802f Binary files /dev/null and "b/security-reports/2023-05-Nibiru-Salus-Penetration-Testing-Report-V2-\350\204\261\346\225\217.pdf" differ diff --git a/security-reports/2023-07-Nibiru-Zellic-Audit-Report.pdf b/security-reports/2023-07-Nibiru-Zellic-Audit-Report.pdf new file mode 100644 index 000000000..3d9a03167 Binary files /dev/null and b/security-reports/2023-07-Nibiru-Zellic-Audit-Report.pdf differ diff --git a/security-reports/2023-09-30-Nibiru-ITN2-Chain-Halt.md b/security-reports/2023-09-30-Nibiru-ITN2-Chain-Halt.md new file mode 100644 index 000000000..7ed3e3a31 --- /dev/null +++ b/security-reports/2023-09-30-Nibiru-ITN2-Chain-Halt.md @@ -0,0 +1,15 @@ +# Postmortem + +## Summary + +On Sept 30 @ 22:16:01 UTC time, the `nibiru-itn-2` network halted at block `1131575`. + +## Root Cause + +The binary was missing a wasm extension that copies the `wasm` smart contract folder for state syncs. Nodes that joined the network via state sync were missing `wasm` smart contracts. Later on, these nodes became validator nodes, and the set of smart contracts differed between validator nodes. + +A tx in block `1131574` was submitted against one of these missing smart contracts (with code_id 3). Some validators were able to execute the tx successfully and other validators errored out since they didn’t have the wasm smart contract in their local disk. Hence the chain halted while validating the `app_hash` in block `1131575`. + +## Resolution + +The issue was fixed in [PR #1616](https://github.com/NibiruChain/nibiru/pull/1616) and backported to the [v0.21.x release branch](https://github.com/NibiruChain/nibiru/tree/releases/v0.21.x) (currently in [v0.21.11](https://github.com/NibiruChain/nibiru/releases/tag/v0.21.11)). \ No newline at end of file diff --git a/security-reports/README.md b/security-reports/README.md new file mode 100644 index 000000000..fefa16e3c --- /dev/null +++ b/security-reports/README.md @@ -0,0 +1,13 @@ +# Nibiru/security-reports + +Audits and security reports related to Nibiru blockchain, related smart contracts, and core applications. + +## Audit History + +- **2024-11 Nibiru Audit - Code4rena Competitive Audit**: (Report in progress) +- **2024-10 Nibiru Audit - Code4rena Zenith Audit**: (Report in progress) +- **2023-09-30-Nibiru-ITN2-Chain-Halt.md**: Report of a chain halt resulting from +high volatility in Nibiru Oracle exchange rates, causing unwarranted slashing of +the validator set that powers the oracle. +- **2023-07-Nibiru-Zellic-Audit-Report.pdf**: ... +- **2023-05-Nibiru-Salus-Penetration-Testing-Report-V2-脱敏.pdf**: ... diff --git a/x/common/paginate_test.go b/x/common/paginate_test.go index 4aa410041..f3a3744be 100644 --- a/x/common/paginate_test.go +++ b/x/common/paginate_test.go @@ -74,7 +74,7 @@ func (s *paginateSuite) TestParsePagination() { wantOffset: 99, }, } { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { gotPageReq, gotPage, gotErr := common.ParsePagination(tc.pageReq) s.EqualValues(tc.wantPage, gotPage) diff --git a/x/common/testutil/testapp/testapp.go b/x/common/testutil/testapp/testapp.go index feb6e52b5..d8507b099 100644 --- a/x/common/testutil/testapp/testapp.go +++ b/x/common/testutil/testapp/testapp.go @@ -12,6 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + auth "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/NibiruChain/nibiru/v2/app" @@ -183,6 +184,19 @@ func FundModuleAccount( return bankKeeper.SendCoinsFromModuleToModule(ctx, inflationtypes.ModuleName, recipientMod, amounts) } +// FundFeeCollector funds the module account that collects gas fees with some +// amount of "unibi", the gas token. +func FundFeeCollector( + bk bankkeeper.Keeper, ctx sdk.Context, amount math.Int, +) error { + return FundModuleAccount( + bk, + ctx, + auth.FeeCollectorName, + sdk.NewCoins(sdk.NewCoin(appconst.BondDenom, amount)), + ) +} + // EnsureNibiruPrefix sets the account address prefix to Nibiru's rather than // the default from the Cosmos-SDK, guaranteeing that tests will work with nibi // addresses rather than cosmos ones (for Gaia). diff --git a/x/common/testutil/testnetwork/tx_test.go b/x/common/testutil/testnetwork/tx_test.go index 94a9db6bd..7912b8cea 100644 --- a/x/common/testutil/testnetwork/tx_test.go +++ b/x/common/testutil/testnetwork/tx_test.go @@ -1,8 +1,6 @@ package testnetwork_test import ( - "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "cosmossdk.io/math" @@ -37,7 +35,7 @@ func (s *TestSuite) TestExecTx() { s.NoError(err) s.EqualValues(0, txResp.Code) - s.T().Run("test tx option changes", func(t *testing.T) { + s.Run("test tx option changes", func() { defaultOpts := testnetwork.DEFAULT_TX_OPTIONS opts := testnetwork.WithTxOptions(testnetwork.TxOptionChanges{ BroadcastMode: &defaultOpts.BroadcastMode, @@ -52,7 +50,7 @@ func (s *TestSuite) TestExecTx() { s.EqualValues(0, txResp.Code) }) - s.T().Run("fail when validators are missing", func(t *testing.T) { + s.Run("fail when validators are missing", func() { networkNoVals := new(testnetwork.Network) *networkNoVals = *s.network networkNoVals.Validators = []*testnetwork.Validator{} diff --git a/x/devgas/v1/ante/ante_test.go b/x/devgas/v1/ante/ante_test.go index 8e9a6f5c8..75a974e04 100644 --- a/x/devgas/v1/ante/ante_test.go +++ b/x/devgas/v1/ante/ante_test.go @@ -236,7 +236,8 @@ func (suite *AnteTestSuite) TestDevGasPayout() { } for _, tc := range testCases { - suite.T().Run(tc.name, func(t *testing.T) { + suite.Run(tc.name, func() { + t := suite.T() bapp, ctx := tc.setup() ctx = ctx.WithChainID("mock-chain-id") anteDecorator := devgasante.NewDevGasPayoutDecorator( diff --git a/x/devgas/v1/genesis_test.go b/x/devgas/v1/genesis_test.go index 332f10f2b..7c450f608 100644 --- a/x/devgas/v1/genesis_test.go +++ b/x/devgas/v1/genesis_test.go @@ -109,7 +109,7 @@ func (s *GenesisTestSuite) TestGenesis() { } for _, tc := range testCases { - s.T().Run(fmt.Sprintf("Case %s", tc.name), func(t *testing.T) { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { s.SetupTest() // reset if tc.expPanic { diff --git a/x/devgas/v1/types/msg_test.go b/x/devgas/v1/types/msg_test.go index fb41cba0f..38ef569cf 100644 --- a/x/devgas/v1/types/msg_test.go +++ b/x/devgas/v1/types/msg_test.go @@ -276,7 +276,7 @@ func (s *MsgsTestSuite) TestQuery_ValidateBasic() { }, }, } { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { tc.test() }) } diff --git a/x/evm/embeds/artifacts/contracts/IFunToken.sol/IFunToken.json b/x/evm/embeds/artifacts/contracts/IFunToken.sol/IFunToken.json index 5877e277b..39c5d7aef 100644 --- a/x/evm/embeds/artifacts/contracts/IFunToken.sol/IFunToken.json +++ b/x/evm/embeds/artifacts/contracts/IFunToken.sol/IFunToken.json @@ -3,6 +3,25 @@ "contractName": "IFunToken", "sourceName": "contracts/IFunToken.sol", "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "string", + "name": "eventType", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "abciEvent", + "type": "string" + } + ], + "name": "AbciEvent", + "type": "event" + }, { "inputs": [ { diff --git a/x/evm/embeds/artifacts/contracts/NibiruEvmUtils.sol/INibiruEvm.json b/x/evm/embeds/artifacts/contracts/NibiruEvmUtils.sol/INibiruEvm.json new file mode 100644 index 000000000..9704d7497 --- /dev/null +++ b/x/evm/embeds/artifacts/contracts/NibiruEvmUtils.sol/INibiruEvm.json @@ -0,0 +1,30 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "INibiruEvm", + "sourceName": "contracts/NibiruEvmUtils.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "string", + "name": "eventType", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "abciEvent", + "type": "string" + } + ], + "name": "AbciEvent", + "type": "event" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/x/evm/embeds/artifacts/contracts/TestERC20TransferThenPrecompileSend.sol/TestERC20TransferThenPrecompileSend.json b/x/evm/embeds/artifacts/contracts/TestERC20TransferThenPrecompileSend.sol/TestERC20TransferThenPrecompileSend.json index a01b550fc..7e02b8803 100644 --- a/x/evm/embeds/artifacts/contracts/TestERC20TransferThenPrecompileSend.sol/TestERC20TransferThenPrecompileSend.json +++ b/x/evm/embeds/artifacts/contracts/TestERC20TransferThenPrecompileSend.sol/TestERC20TransferThenPrecompileSend.json @@ -43,8 +43,8 @@ "type": "function" } ], - "bytecode": "0x608060405234801561001057600080fd5b50604051610c4c380380610c4c833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610b35806101176000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063264c325814610030575b600080fd5b61004a6004803603810190610045919061065c565b61004c565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b81526004016100a792919061074d565b6020604051808303816000875af11580156100c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ea91906107ae565b610129576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012090610838565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b815260040161018a939291906108e7565b6020604051808303816000875af11580156101a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cd919061093a565b90508181146101db8261024d565b6101e48461024d565b6040516020016101f5929190610a61565b60405160208183030381529060405290610245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023c9190610aae565b60405180910390fd5b505050505050565b60606000600161025c8461031b565b01905060008167ffffffffffffffff81111561027b5761027a610531565b5b6040519080825280601f01601f1916602001820160405280156102ad5781602001600182028036833780820191505090505b509050600082602001820190505b600115610310578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161030457610303610ad0565b5b049450600085036102bb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610379577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161036f5761036e610ad0565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106103b6576d04ee2d6d415b85acef810000000083816103ac576103ab610ad0565b5b0492506020810190505b662386f26fc1000083106103e557662386f26fc1000083816103db576103da610ad0565b5b0492506010810190505b6305f5e100831061040e576305f5e100838161040457610403610ad0565b5b0492506008810190505b612710831061043357612710838161042957610428610ad0565b5b0492506004810190505b60648310610456576064838161044c5761044b610ad0565b5b0492506002810190505b600a8310610465576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104ad82610482565b9050919050565b6104bd816104a2565b81146104c857600080fd5b50565b6000813590506104da816104b4565b92915050565b6000819050919050565b6104f3816104e0565b81146104fe57600080fd5b50565b600081359050610510816104ea565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61056982610520565b810181811067ffffffffffffffff8211171561058857610587610531565b5b80604052505050565b600061059b61046e565b90506105a78282610560565b919050565b600067ffffffffffffffff8211156105c7576105c6610531565b5b6105d082610520565b9050602081019050919050565b82818337600083830152505050565b60006105ff6105fa846105ac565b610591565b90508281526020810184848401111561061b5761061a61051b565b5b6106268482856105dd565b509392505050565b600082601f83011261064357610642610516565b5b81356106538482602086016105ec565b91505092915050565b6000806000806080858703121561067657610675610478565b5b6000610684878288016104cb565b945050602061069587828801610501565b935050604085013567ffffffffffffffff8111156106b6576106b561047d565b5b6106c28782880161062e565b92505060606106d387828801610501565b91505092959194509250565b6000819050919050565b60006107046106ff6106fa84610482565b6106df565b610482565b9050919050565b6000610716826106e9565b9050919050565b60006107288261070b565b9050919050565b6107388161071d565b82525050565b610747816104e0565b82525050565b6000604082019050610762600083018561072f565b61076f602083018461073e565b9392505050565b60008115159050919050565b61078b81610776565b811461079657600080fd5b50565b6000815190506107a881610782565b92915050565b6000602082840312156107c4576107c3610478565b5b60006107d284828501610799565b91505092915050565b600082825260208201905092915050565b7f4552432d3230207472616e73666572206661696c656400000000000000000000600082015250565b60006108226016836107db565b915061082d826107ec565b602082019050919050565b6000602082019050818103600083015261085181610815565b9050919050565b600061086382610482565b9050919050565b61087381610858565b82525050565b600081519050919050565b60005b838110156108a2578082015181840152602081019050610887565b60008484015250505050565b60006108b982610879565b6108c381856107db565b93506108d3818560208601610884565b6108dc81610520565b840191505092915050565b60006060820190506108fc600083018661086a565b610909602083018561073e565b818103604083015261091b81846108ae565b9050949350505050565b600081519050610934816104ea565b92915050565b6000602082840312156109505761094f610478565b5b600061095e84828501610925565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109ce603f83610967565b91506109d982610972565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b6000610a1582610879565b610a1f8185610967565b9350610a2f818560208601610884565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a6c826109c1565b9150610a77826109e4565b600b82019150610a878285610a0a565b9150610a9282610a3b565b600982019150610aa28284610a0a565b91508190509392505050565b60006020820190508181036000830152610ac881846108ae565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122042f899f7461653cf1df35f26f5f40f53e56c43892fd0cebd16ecff8d5f83285464736f6c63430008180033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063264c325814610030575b600080fd5b61004a6004803603810190610045919061065c565b61004c565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b81526004016100a792919061074d565b6020604051808303816000875af11580156100c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ea91906107ae565b610129576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012090610838565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b815260040161018a939291906108e7565b6020604051808303816000875af11580156101a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cd919061093a565b90508181146101db8261024d565b6101e48461024d565b6040516020016101f5929190610a61565b60405160208183030381529060405290610245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023c9190610aae565b60405180910390fd5b505050505050565b60606000600161025c8461031b565b01905060008167ffffffffffffffff81111561027b5761027a610531565b5b6040519080825280601f01601f1916602001820160405280156102ad5781602001600182028036833780820191505090505b509050600082602001820190505b600115610310578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161030457610303610ad0565b5b049450600085036102bb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610379577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161036f5761036e610ad0565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106103b6576d04ee2d6d415b85acef810000000083816103ac576103ab610ad0565b5b0492506020810190505b662386f26fc1000083106103e557662386f26fc1000083816103db576103da610ad0565b5b0492506010810190505b6305f5e100831061040e576305f5e100838161040457610403610ad0565b5b0492506008810190505b612710831061043357612710838161042957610428610ad0565b5b0492506004810190505b60648310610456576064838161044c5761044b610ad0565b5b0492506002810190505b600a8310610465576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104ad82610482565b9050919050565b6104bd816104a2565b81146104c857600080fd5b50565b6000813590506104da816104b4565b92915050565b6000819050919050565b6104f3816104e0565b81146104fe57600080fd5b50565b600081359050610510816104ea565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61056982610520565b810181811067ffffffffffffffff8211171561058857610587610531565b5b80604052505050565b600061059b61046e565b90506105a78282610560565b919050565b600067ffffffffffffffff8211156105c7576105c6610531565b5b6105d082610520565b9050602081019050919050565b82818337600083830152505050565b60006105ff6105fa846105ac565b610591565b90508281526020810184848401111561061b5761061a61051b565b5b6106268482856105dd565b509392505050565b600082601f83011261064357610642610516565b5b81356106538482602086016105ec565b91505092915050565b6000806000806080858703121561067657610675610478565b5b6000610684878288016104cb565b945050602061069587828801610501565b935050604085013567ffffffffffffffff8111156106b6576106b561047d565b5b6106c28782880161062e565b92505060606106d387828801610501565b91505092959194509250565b6000819050919050565b60006107046106ff6106fa84610482565b6106df565b610482565b9050919050565b6000610716826106e9565b9050919050565b60006107288261070b565b9050919050565b6107388161071d565b82525050565b610747816104e0565b82525050565b6000604082019050610762600083018561072f565b61076f602083018461073e565b9392505050565b60008115159050919050565b61078b81610776565b811461079657600080fd5b50565b6000815190506107a881610782565b92915050565b6000602082840312156107c4576107c3610478565b5b60006107d284828501610799565b91505092915050565b600082825260208201905092915050565b7f4552432d3230207472616e73666572206661696c656400000000000000000000600082015250565b60006108226016836107db565b915061082d826107ec565b602082019050919050565b6000602082019050818103600083015261085181610815565b9050919050565b600061086382610482565b9050919050565b61087381610858565b82525050565b600081519050919050565b60005b838110156108a2578082015181840152602081019050610887565b60008484015250505050565b60006108b982610879565b6108c381856107db565b93506108d3818560208601610884565b6108dc81610520565b840191505092915050565b60006060820190506108fc600083018661086a565b610909602083018561073e565b818103604083015261091b81846108ae565b9050949350505050565b600081519050610934816104ea565b92915050565b6000602082840312156109505761094f610478565b5b600061095e84828501610925565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109ce603f83610967565b91506109d982610972565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b6000610a1582610879565b610a1f8185610967565b9350610a2f818560208601610884565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a6c826109c1565b9150610a77826109e4565b600b82019150610a878285610a0a565b9150610a9282610a3b565b600982019150610aa28284610a0a565b91508190509392505050565b60006020820190508181036000830152610ac881846108ae565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122042f899f7461653cf1df35f26f5f40f53e56c43892fd0cebd16ecff8d5f83285464736f6c63430008180033", + "bytecode": "0x608060405234801561001057600080fd5b50604051610c4c380380610c4c833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610b35806101176000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063264c325814610030575b600080fd5b61004a6004803603810190610045919061065c565b61004c565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b81526004016100a792919061074d565b6020604051808303816000875af11580156100c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ea91906107ae565b610129576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012090610838565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b815260040161018a939291906108e7565b6020604051808303816000875af11580156101a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cd919061093a565b90508181146101db8261024d565b6101e48461024d565b6040516020016101f5929190610a61565b60405160208183030381529060405290610245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023c9190610aae565b60405180910390fd5b505050505050565b60606000600161025c8461031b565b01905060008167ffffffffffffffff81111561027b5761027a610531565b5b6040519080825280601f01601f1916602001820160405280156102ad5781602001600182028036833780820191505090505b509050600082602001820190505b600115610310578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161030457610303610ad0565b5b049450600085036102bb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610379577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161036f5761036e610ad0565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106103b6576d04ee2d6d415b85acef810000000083816103ac576103ab610ad0565b5b0492506020810190505b662386f26fc1000083106103e557662386f26fc1000083816103db576103da610ad0565b5b0492506010810190505b6305f5e100831061040e576305f5e100838161040457610403610ad0565b5b0492506008810190505b612710831061043357612710838161042957610428610ad0565b5b0492506004810190505b60648310610456576064838161044c5761044b610ad0565b5b0492506002810190505b600a8310610465576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104ad82610482565b9050919050565b6104bd816104a2565b81146104c857600080fd5b50565b6000813590506104da816104b4565b92915050565b6000819050919050565b6104f3816104e0565b81146104fe57600080fd5b50565b600081359050610510816104ea565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61056982610520565b810181811067ffffffffffffffff8211171561058857610587610531565b5b80604052505050565b600061059b61046e565b90506105a78282610560565b919050565b600067ffffffffffffffff8211156105c7576105c6610531565b5b6105d082610520565b9050602081019050919050565b82818337600083830152505050565b60006105ff6105fa846105ac565b610591565b90508281526020810184848401111561061b5761061a61051b565b5b6106268482856105dd565b509392505050565b600082601f83011261064357610642610516565b5b81356106538482602086016105ec565b91505092915050565b6000806000806080858703121561067657610675610478565b5b6000610684878288016104cb565b945050602061069587828801610501565b935050604085013567ffffffffffffffff8111156106b6576106b561047d565b5b6106c28782880161062e565b92505060606106d387828801610501565b91505092959194509250565b6000819050919050565b60006107046106ff6106fa84610482565b6106df565b610482565b9050919050565b6000610716826106e9565b9050919050565b60006107288261070b565b9050919050565b6107388161071d565b82525050565b610747816104e0565b82525050565b6000604082019050610762600083018561072f565b61076f602083018461073e565b9392505050565b60008115159050919050565b61078b81610776565b811461079657600080fd5b50565b6000815190506107a881610782565b92915050565b6000602082840312156107c4576107c3610478565b5b60006107d284828501610799565b91505092915050565b600082825260208201905092915050565b7f4552432d3230207472616e73666572206661696c656400000000000000000000600082015250565b60006108226016836107db565b915061082d826107ec565b602082019050919050565b6000602082019050818103600083015261085181610815565b9050919050565b600061086382610482565b9050919050565b61087381610858565b82525050565b600081519050919050565b60005b838110156108a2578082015181840152602081019050610887565b60008484015250505050565b60006108b982610879565b6108c381856107db565b93506108d3818560208601610884565b6108dc81610520565b840191505092915050565b60006060820190506108fc600083018661086a565b610909602083018561073e565b818103604083015261091b81846108ae565b9050949350505050565b600081519050610934816104ea565b92915050565b6000602082840312156109505761094f610478565b5b600061095e84828501610925565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109ce603f83610967565b91506109d982610972565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b6000610a1582610879565b610a1f8185610967565b9350610a2f818560208601610884565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a6c826109c1565b9150610a77826109e4565b600b82019150610a878285610a0a565b9150610a9282610a3b565b600982019150610aa28284610a0a565b91508190509392505050565b60006020820190508181036000830152610ac881846108ae565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220ac87f92bb48cb96c0379f7c364f408a4b71d1e0ac35283db4a4b8e4963d94c4564736f6c63430008180033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063264c325814610030575b600080fd5b61004a6004803603810190610045919061065c565b61004c565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b81526004016100a792919061074d565b6020604051808303816000875af11580156100c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ea91906107ae565b610129576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012090610838565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b815260040161018a939291906108e7565b6020604051808303816000875af11580156101a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cd919061093a565b90508181146101db8261024d565b6101e48461024d565b6040516020016101f5929190610a61565b60405160208183030381529060405290610245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023c9190610aae565b60405180910390fd5b505050505050565b60606000600161025c8461031b565b01905060008167ffffffffffffffff81111561027b5761027a610531565b5b6040519080825280601f01601f1916602001820160405280156102ad5781602001600182028036833780820191505090505b509050600082602001820190505b600115610310578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161030457610303610ad0565b5b049450600085036102bb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610379577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161036f5761036e610ad0565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106103b6576d04ee2d6d415b85acef810000000083816103ac576103ab610ad0565b5b0492506020810190505b662386f26fc1000083106103e557662386f26fc1000083816103db576103da610ad0565b5b0492506010810190505b6305f5e100831061040e576305f5e100838161040457610403610ad0565b5b0492506008810190505b612710831061043357612710838161042957610428610ad0565b5b0492506004810190505b60648310610456576064838161044c5761044b610ad0565b5b0492506002810190505b600a8310610465576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104ad82610482565b9050919050565b6104bd816104a2565b81146104c857600080fd5b50565b6000813590506104da816104b4565b92915050565b6000819050919050565b6104f3816104e0565b81146104fe57600080fd5b50565b600081359050610510816104ea565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61056982610520565b810181811067ffffffffffffffff8211171561058857610587610531565b5b80604052505050565b600061059b61046e565b90506105a78282610560565b919050565b600067ffffffffffffffff8211156105c7576105c6610531565b5b6105d082610520565b9050602081019050919050565b82818337600083830152505050565b60006105ff6105fa846105ac565b610591565b90508281526020810184848401111561061b5761061a61051b565b5b6106268482856105dd565b509392505050565b600082601f83011261064357610642610516565b5b81356106538482602086016105ec565b91505092915050565b6000806000806080858703121561067657610675610478565b5b6000610684878288016104cb565b945050602061069587828801610501565b935050604085013567ffffffffffffffff8111156106b6576106b561047d565b5b6106c28782880161062e565b92505060606106d387828801610501565b91505092959194509250565b6000819050919050565b60006107046106ff6106fa84610482565b6106df565b610482565b9050919050565b6000610716826106e9565b9050919050565b60006107288261070b565b9050919050565b6107388161071d565b82525050565b610747816104e0565b82525050565b6000604082019050610762600083018561072f565b61076f602083018461073e565b9392505050565b60008115159050919050565b61078b81610776565b811461079657600080fd5b50565b6000815190506107a881610782565b92915050565b6000602082840312156107c4576107c3610478565b5b60006107d284828501610799565b91505092915050565b600082825260208201905092915050565b7f4552432d3230207472616e73666572206661696c656400000000000000000000600082015250565b60006108226016836107db565b915061082d826107ec565b602082019050919050565b6000602082019050818103600083015261085181610815565b9050919050565b600061086382610482565b9050919050565b61087381610858565b82525050565b600081519050919050565b60005b838110156108a2578082015181840152602081019050610887565b60008484015250505050565b60006108b982610879565b6108c381856107db565b93506108d3818560208601610884565b6108dc81610520565b840191505092915050565b60006060820190506108fc600083018661086a565b610909602083018561073e565b818103604083015261091b81846108ae565b9050949350505050565b600081519050610934816104ea565b92915050565b6000602082840312156109505761094f610478565b5b600061095e84828501610925565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109ce603f83610967565b91506109d982610972565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b6000610a1582610879565b610a1f8185610967565b9350610a2f818560208601610884565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a6c826109c1565b9150610a77826109e4565b600b82019150610a878285610a0a565b9150610a9282610a3b565b600982019150610aa28284610a0a565b91508190509392505050565b60006020820190508181036000830152610ac881846108ae565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220ac87f92bb48cb96c0379f7c364f408a4b71d1e0ac35283db4a4b8e4963d94c4564736f6c63430008180033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/x/evm/embeds/artifacts/contracts/TestFunTokenPrecompileLocalGas.sol/TestFunTokenPrecompileLocalGas.json b/x/evm/embeds/artifacts/contracts/TestFunTokenPrecompileLocalGas.sol/TestFunTokenPrecompileLocalGas.json index 83481bdd5..95e833a22 100644 --- a/x/evm/embeds/artifacts/contracts/TestFunTokenPrecompileLocalGas.sol/TestFunTokenPrecompileLocalGas.json +++ b/x/evm/embeds/artifacts/contracts/TestFunTokenPrecompileLocalGas.sol/TestFunTokenPrecompileLocalGas.json @@ -56,8 +56,8 @@ "type": "function" } ], - "bytecode": "0x608060405234801561001057600080fd5b50604051610b6a380380610b6a833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610a53806101176000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806359b6ed891461003b57806390d2b5e714610057575b600080fd5b6100556004803603810190610050919061066b565b610073565b005b610071600480360381019061006c91906106da565b610198565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf8360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687876040518563ffffffff1660e01b81526004016100d593929190610805565b60206040518083038160008887f11580156100f4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906101199190610858565b9050838114610127826102ba565b610130866102ba565b60405160200161014192919061097f565b60405160208183030381529060405290610191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018891906109cc565b60405180910390fd5b5050505050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040518463ffffffff1660e01b81526004016101f993929190610805565b6020604051808303816000875af1158015610218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023c9190610858565b905082811461024a826102ba565b610253856102ba565b60405160200161026492919061097f565b604051602081830303815290604052906102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab91906109cc565b60405180910390fd5b50505050565b6060600060016102c984610388565b01905060008167ffffffffffffffff8111156102e8576102e7610540565b5b6040519080825280601f01601f19166020018201604052801561031a5781602001600182028036833780820191505090505b509050600082602001820190505b60011561037d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581610371576103706109ee565b5b04945060008503610328575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103e6577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103dc576103db6109ee565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310610423576d04ee2d6d415b85acef81000000008381610419576104186109ee565b5b0492506020810190505b662386f26fc10000831061045257662386f26fc100008381610448576104476109ee565b5b0492506010810190505b6305f5e100831061047b576305f5e1008381610471576104706109ee565b5b0492506008810190505b61271083106104a0576127108381610496576104956109ee565b5b0492506004810190505b606483106104c357606483816104b9576104b86109ee565b5b0492506002810190505b600a83106104d2576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b610502816104ef565b811461050d57600080fd5b50565b60008135905061051f816104f9565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105788261052f565b810181811067ffffffffffffffff8211171561059757610596610540565b5b80604052505050565b60006105aa6104db565b90506105b6828261056f565b919050565b600067ffffffffffffffff8211156105d6576105d5610540565b5b6105df8261052f565b9050602081019050919050565b82818337600083830152505050565b600061060e610609846105bb565b6105a0565b90508281526020810184848401111561062a5761062961052a565b5b6106358482856105ec565b509392505050565b600082601f83011261065257610651610525565b5b81356106628482602086016105fb565b91505092915050565b600080600060608486031215610684576106836104e5565b5b600061069286828701610510565b935050602084013567ffffffffffffffff8111156106b3576106b26104ea565b5b6106bf8682870161063d565b92505060406106d086828701610510565b9150509250925092565b600080604083850312156106f1576106f06104e5565b5b60006106ff85828601610510565b925050602083013567ffffffffffffffff8111156107205761071f6104ea565b5b61072c8582860161063d565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076182610736565b9050919050565b61077181610756565b82525050565b610780816104ef565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156107c05780820151818401526020810190506107a5565b60008484015250505050565b60006107d782610786565b6107e18185610791565b93506107f18185602086016107a2565b6107fa8161052f565b840191505092915050565b600060608201905061081a6000830186610768565b6108276020830185610777565b818103604083015261083981846107cc565b9050949350505050565b600081519050610852816104f9565b92915050565b60006020828403121561086e5761086d6104e5565b5b600061087c84828501610843565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006108ec603f83610885565b91506108f782610890565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061093382610786565b61093d8185610885565b935061094d8185602086016107a2565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b600061098a826108df565b915061099582610902565b600b820191506109a58285610928565b91506109b082610959565b6009820191506109c08284610928565b91508190509392505050565b600060208201905081810360008301526109e681846107cc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220518cb8e0a44ff5f83545c95e1dbc30a25da8ee95d0d23b6fac02d6a4c47c4c5164736f6c63430008180033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806359b6ed891461003b57806390d2b5e714610057575b600080fd5b6100556004803603810190610050919061066b565b610073565b005b610071600480360381019061006c91906106da565b610198565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf8360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687876040518563ffffffff1660e01b81526004016100d593929190610805565b60206040518083038160008887f11580156100f4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906101199190610858565b9050838114610127826102ba565b610130866102ba565b60405160200161014192919061097f565b60405160208183030381529060405290610191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018891906109cc565b60405180910390fd5b5050505050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040518463ffffffff1660e01b81526004016101f993929190610805565b6020604051808303816000875af1158015610218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023c9190610858565b905082811461024a826102ba565b610253856102ba565b60405160200161026492919061097f565b604051602081830303815290604052906102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab91906109cc565b60405180910390fd5b50505050565b6060600060016102c984610388565b01905060008167ffffffffffffffff8111156102e8576102e7610540565b5b6040519080825280601f01601f19166020018201604052801561031a5781602001600182028036833780820191505090505b509050600082602001820190505b60011561037d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581610371576103706109ee565b5b04945060008503610328575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103e6577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103dc576103db6109ee565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310610423576d04ee2d6d415b85acef81000000008381610419576104186109ee565b5b0492506020810190505b662386f26fc10000831061045257662386f26fc100008381610448576104476109ee565b5b0492506010810190505b6305f5e100831061047b576305f5e1008381610471576104706109ee565b5b0492506008810190505b61271083106104a0576127108381610496576104956109ee565b5b0492506004810190505b606483106104c357606483816104b9576104b86109ee565b5b0492506002810190505b600a83106104d2576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b610502816104ef565b811461050d57600080fd5b50565b60008135905061051f816104f9565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105788261052f565b810181811067ffffffffffffffff8211171561059757610596610540565b5b80604052505050565b60006105aa6104db565b90506105b6828261056f565b919050565b600067ffffffffffffffff8211156105d6576105d5610540565b5b6105df8261052f565b9050602081019050919050565b82818337600083830152505050565b600061060e610609846105bb565b6105a0565b90508281526020810184848401111561062a5761062961052a565b5b6106358482856105ec565b509392505050565b600082601f83011261065257610651610525565b5b81356106628482602086016105fb565b91505092915050565b600080600060608486031215610684576106836104e5565b5b600061069286828701610510565b935050602084013567ffffffffffffffff8111156106b3576106b26104ea565b5b6106bf8682870161063d565b92505060406106d086828701610510565b9150509250925092565b600080604083850312156106f1576106f06104e5565b5b60006106ff85828601610510565b925050602083013567ffffffffffffffff8111156107205761071f6104ea565b5b61072c8582860161063d565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076182610736565b9050919050565b61077181610756565b82525050565b610780816104ef565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156107c05780820151818401526020810190506107a5565b60008484015250505050565b60006107d782610786565b6107e18185610791565b93506107f18185602086016107a2565b6107fa8161052f565b840191505092915050565b600060608201905061081a6000830186610768565b6108276020830185610777565b818103604083015261083981846107cc565b9050949350505050565b600081519050610852816104f9565b92915050565b60006020828403121561086e5761086d6104e5565b5b600061087c84828501610843565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006108ec603f83610885565b91506108f782610890565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061093382610786565b61093d8185610885565b935061094d8185602086016107a2565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b600061098a826108df565b915061099582610902565b600b820191506109a58285610928565b91506109b082610959565b6009820191506109c08284610928565b91508190509392505050565b600060208201905081810360008301526109e681846107cc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220518cb8e0a44ff5f83545c95e1dbc30a25da8ee95d0d23b6fac02d6a4c47c4c5164736f6c63430008180033", + "bytecode": "0x608060405234801561001057600080fd5b50604051610b6a380380610b6a833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610a53806101176000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806359b6ed891461003b57806390d2b5e714610057575b600080fd5b6100556004803603810190610050919061066b565b610073565b005b610071600480360381019061006c91906106da565b610198565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf8360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687876040518563ffffffff1660e01b81526004016100d593929190610805565b60206040518083038160008887f11580156100f4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906101199190610858565b9050838114610127826102ba565b610130866102ba565b60405160200161014192919061097f565b60405160208183030381529060405290610191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018891906109cc565b60405180910390fd5b5050505050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040518463ffffffff1660e01b81526004016101f993929190610805565b6020604051808303816000875af1158015610218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023c9190610858565b905082811461024a826102ba565b610253856102ba565b60405160200161026492919061097f565b604051602081830303815290604052906102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab91906109cc565b60405180910390fd5b50505050565b6060600060016102c984610388565b01905060008167ffffffffffffffff8111156102e8576102e7610540565b5b6040519080825280601f01601f19166020018201604052801561031a5781602001600182028036833780820191505090505b509050600082602001820190505b60011561037d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581610371576103706109ee565b5b04945060008503610328575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103e6577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103dc576103db6109ee565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310610423576d04ee2d6d415b85acef81000000008381610419576104186109ee565b5b0492506020810190505b662386f26fc10000831061045257662386f26fc100008381610448576104476109ee565b5b0492506010810190505b6305f5e100831061047b576305f5e1008381610471576104706109ee565b5b0492506008810190505b61271083106104a0576127108381610496576104956109ee565b5b0492506004810190505b606483106104c357606483816104b9576104b86109ee565b5b0492506002810190505b600a83106104d2576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b610502816104ef565b811461050d57600080fd5b50565b60008135905061051f816104f9565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105788261052f565b810181811067ffffffffffffffff8211171561059757610596610540565b5b80604052505050565b60006105aa6104db565b90506105b6828261056f565b919050565b600067ffffffffffffffff8211156105d6576105d5610540565b5b6105df8261052f565b9050602081019050919050565b82818337600083830152505050565b600061060e610609846105bb565b6105a0565b90508281526020810184848401111561062a5761062961052a565b5b6106358482856105ec565b509392505050565b600082601f83011261065257610651610525565b5b81356106628482602086016105fb565b91505092915050565b600080600060608486031215610684576106836104e5565b5b600061069286828701610510565b935050602084013567ffffffffffffffff8111156106b3576106b26104ea565b5b6106bf8682870161063d565b92505060406106d086828701610510565b9150509250925092565b600080604083850312156106f1576106f06104e5565b5b60006106ff85828601610510565b925050602083013567ffffffffffffffff8111156107205761071f6104ea565b5b61072c8582860161063d565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076182610736565b9050919050565b61077181610756565b82525050565b610780816104ef565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156107c05780820151818401526020810190506107a5565b60008484015250505050565b60006107d782610786565b6107e18185610791565b93506107f18185602086016107a2565b6107fa8161052f565b840191505092915050565b600060608201905061081a6000830186610768565b6108276020830185610777565b818103604083015261083981846107cc565b9050949350505050565b600081519050610852816104f9565b92915050565b60006020828403121561086e5761086d6104e5565b5b600061087c84828501610843565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006108ec603f83610885565b91506108f782610890565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061093382610786565b61093d8185610885565b935061094d8185602086016107a2565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b600061098a826108df565b915061099582610902565b600b820191506109a58285610928565b91506109b082610959565b6009820191506109c08284610928565b91508190509392505050565b600060208201905081810360008301526109e681846107cc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea26469706673582212201e8ad92ef8f92a3e60b70a83c52bfc446727e39e482a331186bfeb6a9b0b461964736f6c63430008180033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806359b6ed891461003b57806390d2b5e714610057575b600080fd5b6100556004803603810190610050919061066b565b610073565b005b610071600480360381019061006c91906106da565b610198565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf8360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687876040518563ffffffff1660e01b81526004016100d593929190610805565b60206040518083038160008887f11580156100f4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906101199190610858565b9050838114610127826102ba565b610130866102ba565b60405160200161014192919061097f565b60405160208183030381529060405290610191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018891906109cc565b60405180910390fd5b5050505050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040518463ffffffff1660e01b81526004016101f993929190610805565b6020604051808303816000875af1158015610218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023c9190610858565b905082811461024a826102ba565b610253856102ba565b60405160200161026492919061097f565b604051602081830303815290604052906102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab91906109cc565b60405180910390fd5b50505050565b6060600060016102c984610388565b01905060008167ffffffffffffffff8111156102e8576102e7610540565b5b6040519080825280601f01601f19166020018201604052801561031a5781602001600182028036833780820191505090505b509050600082602001820190505b60011561037d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581610371576103706109ee565b5b04945060008503610328575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103e6577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103dc576103db6109ee565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310610423576d04ee2d6d415b85acef81000000008381610419576104186109ee565b5b0492506020810190505b662386f26fc10000831061045257662386f26fc100008381610448576104476109ee565b5b0492506010810190505b6305f5e100831061047b576305f5e1008381610471576104706109ee565b5b0492506008810190505b61271083106104a0576127108381610496576104956109ee565b5b0492506004810190505b606483106104c357606483816104b9576104b86109ee565b5b0492506002810190505b600a83106104d2576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b610502816104ef565b811461050d57600080fd5b50565b60008135905061051f816104f9565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105788261052f565b810181811067ffffffffffffffff8211171561059757610596610540565b5b80604052505050565b60006105aa6104db565b90506105b6828261056f565b919050565b600067ffffffffffffffff8211156105d6576105d5610540565b5b6105df8261052f565b9050602081019050919050565b82818337600083830152505050565b600061060e610609846105bb565b6105a0565b90508281526020810184848401111561062a5761062961052a565b5b6106358482856105ec565b509392505050565b600082601f83011261065257610651610525565b5b81356106628482602086016105fb565b91505092915050565b600080600060608486031215610684576106836104e5565b5b600061069286828701610510565b935050602084013567ffffffffffffffff8111156106b3576106b26104ea565b5b6106bf8682870161063d565b92505060406106d086828701610510565b9150509250925092565b600080604083850312156106f1576106f06104e5565b5b60006106ff85828601610510565b925050602083013567ffffffffffffffff8111156107205761071f6104ea565b5b61072c8582860161063d565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076182610736565b9050919050565b61077181610756565b82525050565b610780816104ef565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156107c05780820151818401526020810190506107a5565b60008484015250505050565b60006107d782610786565b6107e18185610791565b93506107f18185602086016107a2565b6107fa8161052f565b840191505092915050565b600060608201905061081a6000830186610768565b6108276020830185610777565b818103604083015261083981846107cc565b9050949350505050565b600081519050610852816104f9565b92915050565b60006020828403121561086e5761086d6104e5565b5b600061087c84828501610843565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006108ec603f83610885565b91506108f782610890565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061093382610786565b61093d8185610885565b935061094d8185602086016107a2565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b600061098a826108df565b915061099582610902565b600b820191506109a58285610928565b91506109b082610959565b6009820191506109c08284610928565b91508190509392505050565b600060208201905081810360008301526109e681846107cc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea26469706673582212201e8ad92ef8f92a3e60b70a83c52bfc446727e39e482a331186bfeb6a9b0b461964736f6c63430008180033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/x/evm/embeds/artifacts/contracts/TestInfiniteRecursionERC20.sol/TestInfiniteRecursionERC20.json b/x/evm/embeds/artifacts/contracts/TestInfiniteRecursionERC20.sol/TestInfiniteRecursionERC20.json new file mode 100644 index 000000000..536693168 --- /dev/null +++ b/x/evm/embeds/artifacts/contracts/TestInfiniteRecursionERC20.sol/TestInfiniteRecursionERC20.json @@ -0,0 +1,316 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "TestInfiniteRecursionERC20", + "sourceName": "contracts/TestInfiniteRecursionERC20.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "attackBalance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "attackTransfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "who", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b5060405162001df438038062001df48339818101604052810190620000379190620003cc565b828281600390816200004a9190620006b1565b5080600490816200005c9190620006b1565b5050506200007b3369d3c21bcecceda10000006200008460201b60201c565b505050620008b3565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620000f6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620000ed90620007f9565b60405180910390fd5b6200010a60008383620001f160201b60201c565b80600260008282546200011e91906200084a565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620001d1919062000896565b60405180910390a3620001ed60008383620001f660201b60201c565b5050565b505050565b505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620002648262000219565b810181811067ffffffffffffffff821117156200028657620002856200022a565b5b80604052505050565b60006200029b620001fb565b9050620002a9828262000259565b919050565b600067ffffffffffffffff821115620002cc57620002cb6200022a565b5b620002d78262000219565b9050602081019050919050565b60005b8381101562000304578082015181840152602081019050620002e7565b60008484015250505050565b6000620003276200032184620002ae565b6200028f565b90508281526020810184848401111562000346576200034562000214565b5b62000353848285620002e4565b509392505050565b600082601f8301126200037357620003726200020f565b5b81516200038584826020860162000310565b91505092915050565b600060ff82169050919050565b620003a6816200038e565b8114620003b257600080fd5b50565b600081519050620003c6816200039b565b92915050565b600080600060608486031215620003e857620003e762000205565b5b600084015167ffffffffffffffff8111156200040957620004086200020a565b5b62000417868287016200035b565b935050602084015167ffffffffffffffff8111156200043b576200043a6200020a565b5b62000449868287016200035b565b92505060406200045c86828701620003b5565b9150509250925092565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620004b957607f821691505b602082108103620004cf57620004ce62000471565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620005397fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620004fa565b620005458683620004fa565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620005926200058c62000586846200055d565b62000567565b6200055d565b9050919050565b6000819050919050565b620005ae8362000571565b620005c6620005bd8262000599565b84845462000507565b825550505050565b600090565b620005dd620005ce565b620005ea818484620005a3565b505050565b5b81811015620006125762000606600082620005d3565b600181019050620005f0565b5050565b601f82111562000661576200062b81620004d5565b6200063684620004ea565b8101602085101562000646578190505b6200065e6200065585620004ea565b830182620005ef565b50505b505050565b600082821c905092915050565b6000620006866000198460080262000666565b1980831691505092915050565b6000620006a1838362000673565b9150826002028217905092915050565b620006bc8262000466565b67ffffffffffffffff811115620006d857620006d76200022a565b5b620006e48254620004a0565b620006f182828562000616565b600060209050601f83116001811462000729576000841562000714578287015190505b62000720858262000693565b86555062000790565b601f1984166200073986620004d5565b60005b8281101562000763578489015182556001820191506020850194506020810190506200073c565b868310156200078357848901516200077f601f89168262000673565b8355505b6001600288020188555050505b505050505050565b600082825260208201905092915050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b6000620007e1601f8362000798565b9150620007ee82620007a9565b602082019050919050565b600060208201905081810360008301526200081481620007d2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600062000857826200055d565b915062000864836200055d565b92508282019050808211156200087f576200087e6200081b565b5b92915050565b62000890816200055d565b82525050565b6000602082019050620008ad600083018462000885565b92915050565b61153180620008c36000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b4114610202578063a457c2d714610220578063a9059cbb14610250578063dd62ed3e14610280576100cf565b806370a08231146101be5780637a7ffab0146101ee5780638cd64727146101f8576100cf565b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461012257806323b872dd14610140578063313ce56714610170578063395093511461018e575b600080fd5b6100dc6102b0565b6040516100e99190610c88565b60405180910390f35b61010c60048036038101906101079190610d43565b610342565b6040516101199190610d9e565b60405180910390f35b61012a610365565b6040516101379190610dc8565b60405180910390f35b61015a60048036038101906101559190610de3565b61036f565b6040516101679190610d9e565b60405180910390f35b61017861039e565b6040516101859190610e52565b60405180910390f35b6101a860048036038101906101a39190610d43565b6103a7565b6040516101b59190610d9e565b60405180910390f35b6101d860048036038101906101d39190610e6d565b6103de565b6040516101e59190610dc8565b60405180910390f35b6101f66104e2565b005b6102006104f1565b005b61020a6104fe565b6040516102179190610c88565b60405180910390f35b61023a60048036038101906102359190610d43565b610590565b6040516102479190610d9e565b60405180910390f35b61026a60048036038101906102659190610d43565b610607565b6040516102779190610d9e565b60405180910390f35b61029a60048036038101906102959190610e9a565b610694565b6040516102a79190610dc8565b60405180910390f35b6060600380546102bf90610f09565b80601f01602080910402602001604051908101604052809291908181526020018280546102eb90610f09565b80156103385780601f1061030d57610100808354040283529160200191610338565b820191906000526020600020905b81548152906001019060200180831161031b57829003601f168201915b5050505050905090565b60008061034d61071b565b905061035a818585610723565b600191505092915050565b6000600254905090565b60008061037a61071b565b90506103878582856108ec565b610392858585610978565b60019150509392505050565b60006012905090565b6000806103b261071b565b90506103d38185856103c48589610694565b6103ce9190610f69565b610723565b600191505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff16823060405160240161040c929190610fac565b6040516020818303038152906040527fb203bb99000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610496919061101c565b600060405180830381855afa9150503d80600081146104d1576040519150601f19603f3d011682016040523d82523d6000602084013e6104d6565b606091505b50505060009050919050565b6104ee60006001610607565b50565b6104fb60006103de565b50565b60606004805461050d90610f09565b80601f016020809104026020016040519081016040528092919081815260200182805461053990610f09565b80156105865780601f1061055b57610100808354040283529160200191610586565b820191906000526020600020905b81548152906001019060200180831161056957829003601f168201915b5050505050905090565b60008061059b61071b565b905060006105a98286610694565b9050838110156105ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e5906110a5565b60405180910390fd5b6105fb8286868403610723565b60019250505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf30846040518363ffffffff1660e01b8152600401610646929190611137565b6020604051808303816000875af1158015610665573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106899190611188565b506001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610792576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078990611227565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610801576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f8906112b9565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516108df9190610dc8565b60405180910390a3505050565b60006108f88484610694565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109725781811015610964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095b90611325565b60405180910390fd5b6109718484848403610723565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036109e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109de906113b7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4d90611449565b60405180910390fd5b610a61838383610bee565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610ae7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ade906114db565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bd59190610dc8565b60405180910390a3610be8848484610bf3565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610c32578082015181840152602081019050610c17565b60008484015250505050565b6000601f19601f8301169050919050565b6000610c5a82610bf8565b610c648185610c03565b9350610c74818560208601610c14565b610c7d81610c3e565b840191505092915050565b60006020820190508181036000830152610ca28184610c4f565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610cda82610caf565b9050919050565b610cea81610ccf565b8114610cf557600080fd5b50565b600081359050610d0781610ce1565b92915050565b6000819050919050565b610d2081610d0d565b8114610d2b57600080fd5b50565b600081359050610d3d81610d17565b92915050565b60008060408385031215610d5a57610d59610caa565b5b6000610d6885828601610cf8565b9250506020610d7985828601610d2e565b9150509250929050565b60008115159050919050565b610d9881610d83565b82525050565b6000602082019050610db36000830184610d8f565b92915050565b610dc281610d0d565b82525050565b6000602082019050610ddd6000830184610db9565b92915050565b600080600060608486031215610dfc57610dfb610caa565b5b6000610e0a86828701610cf8565b9350506020610e1b86828701610cf8565b9250506040610e2c86828701610d2e565b9150509250925092565b600060ff82169050919050565b610e4c81610e36565b82525050565b6000602082019050610e676000830184610e43565b92915050565b600060208284031215610e8357610e82610caa565b5b6000610e9184828501610cf8565b91505092915050565b60008060408385031215610eb157610eb0610caa565b5b6000610ebf85828601610cf8565b9250506020610ed085828601610cf8565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610f2157607f821691505b602082108103610f3457610f33610eda565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610f7482610d0d565b9150610f7f83610d0d565b9250828201905080821115610f9757610f96610f3a565b5b92915050565b610fa681610ccf565b82525050565b6000604082019050610fc16000830185610f9d565b610fce6020830184610f9d565b9392505050565b600081519050919050565b600081905092915050565b6000610ff682610fd5565b6110008185610fe0565b9350611010818560208601610c14565b80840191505092915050565b60006110288284610feb565b915081905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b600061108f602583610c03565b915061109a82611033565b604082019050919050565b600060208201905081810360008301526110be81611082565b9050919050565b7f6e696269317a616176767a78657a30656c756e64746e3332716e6b396c6b6d3860008201527f6b6d63737a34346737786c000000000000000000000000000000000000000000602082015250565b6000611121602b83610c03565b915061112c826110c5565b604082019050919050565b600060608201905061114c6000830185610f9d565b6111596020830184610db9565b818103604083015261116a81611114565b90509392505050565b60008151905061118281610d17565b92915050565b60006020828403121561119e5761119d610caa565b5b60006111ac84828501611173565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611211602483610c03565b915061121c826111b5565b604082019050919050565b6000602082019050818103600083015261124081611204565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006112a3602283610c03565b91506112ae82611247565b604082019050919050565b600060208201905081810360008301526112d281611296565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061130f601d83610c03565b915061131a826112d9565b602082019050919050565b6000602082019050818103600083015261133e81611302565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006113a1602583610c03565b91506113ac82611345565b604082019050919050565b600060208201905081810360008301526113d081611394565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611433602383610c03565b915061143e826113d7565b604082019050919050565b6000602082019050818103600083015261146281611426565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006114c5602683610c03565b91506114d082611469565b604082019050919050565b600060208201905081810360008301526114f4816114b8565b905091905056fea264697066735822122096c68f812e5de57f5cf1d71e46f7d6a21c025911ca1f9c5f849f3bb63235d4e764736f6c63430008180033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b4114610202578063a457c2d714610220578063a9059cbb14610250578063dd62ed3e14610280576100cf565b806370a08231146101be5780637a7ffab0146101ee5780638cd64727146101f8576100cf565b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461012257806323b872dd14610140578063313ce56714610170578063395093511461018e575b600080fd5b6100dc6102b0565b6040516100e99190610c88565b60405180910390f35b61010c60048036038101906101079190610d43565b610342565b6040516101199190610d9e565b60405180910390f35b61012a610365565b6040516101379190610dc8565b60405180910390f35b61015a60048036038101906101559190610de3565b61036f565b6040516101679190610d9e565b60405180910390f35b61017861039e565b6040516101859190610e52565b60405180910390f35b6101a860048036038101906101a39190610d43565b6103a7565b6040516101b59190610d9e565b60405180910390f35b6101d860048036038101906101d39190610e6d565b6103de565b6040516101e59190610dc8565b60405180910390f35b6101f66104e2565b005b6102006104f1565b005b61020a6104fe565b6040516102179190610c88565b60405180910390f35b61023a60048036038101906102359190610d43565b610590565b6040516102479190610d9e565b60405180910390f35b61026a60048036038101906102659190610d43565b610607565b6040516102779190610d9e565b60405180910390f35b61029a60048036038101906102959190610e9a565b610694565b6040516102a79190610dc8565b60405180910390f35b6060600380546102bf90610f09565b80601f01602080910402602001604051908101604052809291908181526020018280546102eb90610f09565b80156103385780601f1061030d57610100808354040283529160200191610338565b820191906000526020600020905b81548152906001019060200180831161031b57829003601f168201915b5050505050905090565b60008061034d61071b565b905061035a818585610723565b600191505092915050565b6000600254905090565b60008061037a61071b565b90506103878582856108ec565b610392858585610978565b60019150509392505050565b60006012905090565b6000806103b261071b565b90506103d38185856103c48589610694565b6103ce9190610f69565b610723565b600191505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff16823060405160240161040c929190610fac565b6040516020818303038152906040527fb203bb99000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610496919061101c565b600060405180830381855afa9150503d80600081146104d1576040519150601f19603f3d011682016040523d82523d6000602084013e6104d6565b606091505b50505060009050919050565b6104ee60006001610607565b50565b6104fb60006103de565b50565b60606004805461050d90610f09565b80601f016020809104026020016040519081016040528092919081815260200182805461053990610f09565b80156105865780601f1061055b57610100808354040283529160200191610586565b820191906000526020600020905b81548152906001019060200180831161056957829003601f168201915b5050505050905090565b60008061059b61071b565b905060006105a98286610694565b9050838110156105ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e5906110a5565b60405180910390fd5b6105fb8286868403610723565b60019250505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf30846040518363ffffffff1660e01b8152600401610646929190611137565b6020604051808303816000875af1158015610665573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106899190611188565b506001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610792576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078990611227565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610801576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f8906112b9565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516108df9190610dc8565b60405180910390a3505050565b60006108f88484610694565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109725781811015610964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095b90611325565b60405180910390fd5b6109718484848403610723565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036109e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109de906113b7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4d90611449565b60405180910390fd5b610a61838383610bee565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610ae7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ade906114db565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bd59190610dc8565b60405180910390a3610be8848484610bf3565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610c32578082015181840152602081019050610c17565b60008484015250505050565b6000601f19601f8301169050919050565b6000610c5a82610bf8565b610c648185610c03565b9350610c74818560208601610c14565b610c7d81610c3e565b840191505092915050565b60006020820190508181036000830152610ca28184610c4f565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610cda82610caf565b9050919050565b610cea81610ccf565b8114610cf557600080fd5b50565b600081359050610d0781610ce1565b92915050565b6000819050919050565b610d2081610d0d565b8114610d2b57600080fd5b50565b600081359050610d3d81610d17565b92915050565b60008060408385031215610d5a57610d59610caa565b5b6000610d6885828601610cf8565b9250506020610d7985828601610d2e565b9150509250929050565b60008115159050919050565b610d9881610d83565b82525050565b6000602082019050610db36000830184610d8f565b92915050565b610dc281610d0d565b82525050565b6000602082019050610ddd6000830184610db9565b92915050565b600080600060608486031215610dfc57610dfb610caa565b5b6000610e0a86828701610cf8565b9350506020610e1b86828701610cf8565b9250506040610e2c86828701610d2e565b9150509250925092565b600060ff82169050919050565b610e4c81610e36565b82525050565b6000602082019050610e676000830184610e43565b92915050565b600060208284031215610e8357610e82610caa565b5b6000610e9184828501610cf8565b91505092915050565b60008060408385031215610eb157610eb0610caa565b5b6000610ebf85828601610cf8565b9250506020610ed085828601610cf8565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610f2157607f821691505b602082108103610f3457610f33610eda565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610f7482610d0d565b9150610f7f83610d0d565b9250828201905080821115610f9757610f96610f3a565b5b92915050565b610fa681610ccf565b82525050565b6000604082019050610fc16000830185610f9d565b610fce6020830184610f9d565b9392505050565b600081519050919050565b600081905092915050565b6000610ff682610fd5565b6110008185610fe0565b9350611010818560208601610c14565b80840191505092915050565b60006110288284610feb565b915081905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b600061108f602583610c03565b915061109a82611033565b604082019050919050565b600060208201905081810360008301526110be81611082565b9050919050565b7f6e696269317a616176767a78657a30656c756e64746e3332716e6b396c6b6d3860008201527f6b6d63737a34346737786c000000000000000000000000000000000000000000602082015250565b6000611121602b83610c03565b915061112c826110c5565b604082019050919050565b600060608201905061114c6000830185610f9d565b6111596020830184610db9565b818103604083015261116a81611114565b90509392505050565b60008151905061118281610d17565b92915050565b60006020828403121561119e5761119d610caa565b5b60006111ac84828501611173565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611211602483610c03565b915061121c826111b5565b604082019050919050565b6000602082019050818103600083015261124081611204565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006112a3602283610c03565b91506112ae82611247565b604082019050919050565b600060208201905081810360008301526112d281611296565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061130f601d83610c03565b915061131a826112d9565b602082019050919050565b6000602082019050818103600083015261133e81611302565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006113a1602583610c03565b91506113ac82611345565b604082019050919050565b600060208201905081810360008301526113d081611394565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611433602383610c03565b915061143e826113d7565b604082019050919050565b6000602082019050818103600083015261146281611426565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006114c5602683610c03565b91506114d082611469565b604082019050919050565b600060208201905081810360008301526114f4816114b8565b905091905056fea264697066735822122096c68f812e5de57f5cf1d71e46f7d6a21c025911ca1f9c5f849f3bb63235d4e764736f6c63430008180033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/x/evm/embeds/artifacts/contracts/TestNativeSendThenPrecompileSend.sol/TestNativeSendThenPrecompileSend.json b/x/evm/embeds/artifacts/contracts/TestNativeSendThenPrecompileSend.sol/TestNativeSendThenPrecompileSend.json index 60af0f4ee..7891904a1 100644 --- a/x/evm/embeds/artifacts/contracts/TestNativeSendThenPrecompileSend.sol/TestNativeSendThenPrecompileSend.json +++ b/x/evm/embeds/artifacts/contracts/TestNativeSendThenPrecompileSend.sol/TestNativeSendThenPrecompileSend.json @@ -61,8 +61,8 @@ "type": "function" } ], - "bytecode": "0x608060405234801561001057600080fd5b50604051610ca1380380610ca1833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610b8a806101176000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630a04fd4d1461003b578063a4de557414610057575b600080fd5b610055600480360381019061005091906106e4565b610073565b005b610071600480360381019061006c919061079e565b610195565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016100d4939291906108d0565b6020604051808303816000875af11580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610923565b905081811461012582610333565b61012e84610333565b60405160200161013f929190610a4a565b6040516020818303038152906040529061018f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101869190610a97565b60405180910390fd5b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f1935050505090508061020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020590610b05565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685876040518463ffffffff1660e01b815260040161026f939291906108d0565b6020604051808303816000875af115801561028e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b29190610923565b90508281146102c082610333565b6102c985610333565b6040516020016102da929190610a4a565b6040516020818303038152906040529061032a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103219190610a97565b60405180910390fd5b50505050505050565b60606000600161034284610401565b01905060008167ffffffffffffffff81111561036157610360610583565b5b6040519080825280601f01601f1916602001820160405280156103935781602001600182028036833780820191505090505b509050600082602001820190505b6001156103f6578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816103ea576103e9610b25565b5b049450600085036103a1575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061045f577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161045557610454610b25565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061049c576d04ee2d6d415b85acef8100000000838161049257610491610b25565b5b0492506020810190505b662386f26fc1000083106104cb57662386f26fc1000083816104c1576104c0610b25565b5b0492506010810190505b6305f5e10083106104f4576305f5e10083816104ea576104e9610b25565b5b0492506008810190505b612710831061051957612710838161050f5761050e610b25565b5b0492506004810190505b6064831061053c576064838161053257610531610b25565b5b0492506002810190505b600a831061054b576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105bb82610572565b810181811067ffffffffffffffff821117156105da576105d9610583565b5b80604052505050565b60006105ed610554565b90506105f982826105b2565b919050565b600067ffffffffffffffff82111561061957610618610583565b5b61062282610572565b9050602081019050919050565b82818337600083830152505050565b600061065161064c846105fe565b6105e3565b90508281526020810184848401111561066d5761066c61056d565b5b61067884828561062f565b509392505050565b600082601f83011261069557610694610568565b5b81356106a584826020860161063e565b91505092915050565b6000819050919050565b6106c1816106ae565b81146106cc57600080fd5b50565b6000813590506106de816106b8565b92915050565b600080604083850312156106fb576106fa61055e565b5b600083013567ffffffffffffffff81111561071957610718610563565b5b61072585828601610680565b9250506020610736858286016106cf565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076b82610740565b9050919050565b61077b81610760565b811461078657600080fd5b50565b60008135905061079881610772565b92915050565b600080600080608085870312156107b8576107b761055e565b5b60006107c687828801610789565b94505060206107d7878288016106cf565b935050604085013567ffffffffffffffff8111156107f8576107f7610563565b5b61080487828801610680565b9250506060610815878288016106cf565b91505092959194509250565b600061082c82610740565b9050919050565b61083c81610821565b82525050565b61084b816106ae565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561088b578082015181840152602081019050610870565b60008484015250505050565b60006108a282610851565b6108ac818561085c565b93506108bc81856020860161086d565b6108c581610572565b840191505092915050565b60006060820190506108e56000830186610833565b6108f26020830185610842565b81810360408301526109048184610897565b9050949350505050565b60008151905061091d816106b8565b92915050565b6000602082840312156109395761093861055e565b5b60006109478482850161090e565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109b7603f83610950565b91506109c28261095b565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b60006109fe82610851565b610a088185610950565b9350610a1881856020860161086d565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a55826109aa565b9150610a60826109cd565b600b82019150610a7082856109f3565b9150610a7b82610a24565b600982019150610a8b82846109f3565b91508190509392505050565b60006020820190508181036000830152610ab18184610897565b905092915050565b7f4661696c656420746f2073656e64206e617469766520746f6b656e0000000000600082015250565b6000610aef601b8361085c565b9150610afa82610ab9565b602082019050919050565b60006020820190508181036000830152610b1e81610ae2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea26469706673582212200d00fcf0f8c292ec663c93dd26e426953911b9d9cfb7f41829934866e308cbde64736f6c63430008180033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630a04fd4d1461003b578063a4de557414610057575b600080fd5b610055600480360381019061005091906106e4565b610073565b005b610071600480360381019061006c919061079e565b610195565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016100d4939291906108d0565b6020604051808303816000875af11580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610923565b905081811461012582610333565b61012e84610333565b60405160200161013f929190610a4a565b6040516020818303038152906040529061018f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101869190610a97565b60405180910390fd5b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f1935050505090508061020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020590610b05565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685876040518463ffffffff1660e01b815260040161026f939291906108d0565b6020604051808303816000875af115801561028e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b29190610923565b90508281146102c082610333565b6102c985610333565b6040516020016102da929190610a4a565b6040516020818303038152906040529061032a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103219190610a97565b60405180910390fd5b50505050505050565b60606000600161034284610401565b01905060008167ffffffffffffffff81111561036157610360610583565b5b6040519080825280601f01601f1916602001820160405280156103935781602001600182028036833780820191505090505b509050600082602001820190505b6001156103f6578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816103ea576103e9610b25565b5b049450600085036103a1575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061045f577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161045557610454610b25565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061049c576d04ee2d6d415b85acef8100000000838161049257610491610b25565b5b0492506020810190505b662386f26fc1000083106104cb57662386f26fc1000083816104c1576104c0610b25565b5b0492506010810190505b6305f5e10083106104f4576305f5e10083816104ea576104e9610b25565b5b0492506008810190505b612710831061051957612710838161050f5761050e610b25565b5b0492506004810190505b6064831061053c576064838161053257610531610b25565b5b0492506002810190505b600a831061054b576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105bb82610572565b810181811067ffffffffffffffff821117156105da576105d9610583565b5b80604052505050565b60006105ed610554565b90506105f982826105b2565b919050565b600067ffffffffffffffff82111561061957610618610583565b5b61062282610572565b9050602081019050919050565b82818337600083830152505050565b600061065161064c846105fe565b6105e3565b90508281526020810184848401111561066d5761066c61056d565b5b61067884828561062f565b509392505050565b600082601f83011261069557610694610568565b5b81356106a584826020860161063e565b91505092915050565b6000819050919050565b6106c1816106ae565b81146106cc57600080fd5b50565b6000813590506106de816106b8565b92915050565b600080604083850312156106fb576106fa61055e565b5b600083013567ffffffffffffffff81111561071957610718610563565b5b61072585828601610680565b9250506020610736858286016106cf565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076b82610740565b9050919050565b61077b81610760565b811461078657600080fd5b50565b60008135905061079881610772565b92915050565b600080600080608085870312156107b8576107b761055e565b5b60006107c687828801610789565b94505060206107d7878288016106cf565b935050604085013567ffffffffffffffff8111156107f8576107f7610563565b5b61080487828801610680565b9250506060610815878288016106cf565b91505092959194509250565b600061082c82610740565b9050919050565b61083c81610821565b82525050565b61084b816106ae565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561088b578082015181840152602081019050610870565b60008484015250505050565b60006108a282610851565b6108ac818561085c565b93506108bc81856020860161086d565b6108c581610572565b840191505092915050565b60006060820190506108e56000830186610833565b6108f26020830185610842565b81810360408301526109048184610897565b9050949350505050565b60008151905061091d816106b8565b92915050565b6000602082840312156109395761093861055e565b5b60006109478482850161090e565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109b7603f83610950565b91506109c28261095b565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b60006109fe82610851565b610a088185610950565b9350610a1881856020860161086d565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a55826109aa565b9150610a60826109cd565b600b82019150610a7082856109f3565b9150610a7b82610a24565b600982019150610a8b82846109f3565b91508190509392505050565b60006020820190508181036000830152610ab18184610897565b905092915050565b7f4661696c656420746f2073656e64206e617469766520746f6b656e0000000000600082015250565b6000610aef601b8361085c565b9150610afa82610ab9565b602082019050919050565b60006020820190508181036000830152610b1e81610ae2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea26469706673582212200d00fcf0f8c292ec663c93dd26e426953911b9d9cfb7f41829934866e308cbde64736f6c63430008180033", + "bytecode": "0x608060405234801561001057600080fd5b50604051610ca1380380610ca1833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610b8a806101176000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630a04fd4d1461003b578063a4de557414610057575b600080fd5b610055600480360381019061005091906106e4565b610073565b005b610071600480360381019061006c919061079e565b610195565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016100d4939291906108d0565b6020604051808303816000875af11580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610923565b905081811461012582610333565b61012e84610333565b60405160200161013f929190610a4a565b6040516020818303038152906040529061018f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101869190610a97565b60405180910390fd5b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f1935050505090508061020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020590610b05565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685876040518463ffffffff1660e01b815260040161026f939291906108d0565b6020604051808303816000875af115801561028e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b29190610923565b90508281146102c082610333565b6102c985610333565b6040516020016102da929190610a4a565b6040516020818303038152906040529061032a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103219190610a97565b60405180910390fd5b50505050505050565b60606000600161034284610401565b01905060008167ffffffffffffffff81111561036157610360610583565b5b6040519080825280601f01601f1916602001820160405280156103935781602001600182028036833780820191505090505b509050600082602001820190505b6001156103f6578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816103ea576103e9610b25565b5b049450600085036103a1575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061045f577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161045557610454610b25565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061049c576d04ee2d6d415b85acef8100000000838161049257610491610b25565b5b0492506020810190505b662386f26fc1000083106104cb57662386f26fc1000083816104c1576104c0610b25565b5b0492506010810190505b6305f5e10083106104f4576305f5e10083816104ea576104e9610b25565b5b0492506008810190505b612710831061051957612710838161050f5761050e610b25565b5b0492506004810190505b6064831061053c576064838161053257610531610b25565b5b0492506002810190505b600a831061054b576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105bb82610572565b810181811067ffffffffffffffff821117156105da576105d9610583565b5b80604052505050565b60006105ed610554565b90506105f982826105b2565b919050565b600067ffffffffffffffff82111561061957610618610583565b5b61062282610572565b9050602081019050919050565b82818337600083830152505050565b600061065161064c846105fe565b6105e3565b90508281526020810184848401111561066d5761066c61056d565b5b61067884828561062f565b509392505050565b600082601f83011261069557610694610568565b5b81356106a584826020860161063e565b91505092915050565b6000819050919050565b6106c1816106ae565b81146106cc57600080fd5b50565b6000813590506106de816106b8565b92915050565b600080604083850312156106fb576106fa61055e565b5b600083013567ffffffffffffffff81111561071957610718610563565b5b61072585828601610680565b9250506020610736858286016106cf565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076b82610740565b9050919050565b61077b81610760565b811461078657600080fd5b50565b60008135905061079881610772565b92915050565b600080600080608085870312156107b8576107b761055e565b5b60006107c687828801610789565b94505060206107d7878288016106cf565b935050604085013567ffffffffffffffff8111156107f8576107f7610563565b5b61080487828801610680565b9250506060610815878288016106cf565b91505092959194509250565b600061082c82610740565b9050919050565b61083c81610821565b82525050565b61084b816106ae565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561088b578082015181840152602081019050610870565b60008484015250505050565b60006108a282610851565b6108ac818561085c565b93506108bc81856020860161086d565b6108c581610572565b840191505092915050565b60006060820190506108e56000830186610833565b6108f26020830185610842565b81810360408301526109048184610897565b9050949350505050565b60008151905061091d816106b8565b92915050565b6000602082840312156109395761093861055e565b5b60006109478482850161090e565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109b7603f83610950565b91506109c28261095b565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b60006109fe82610851565b610a088185610950565b9350610a1881856020860161086d565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a55826109aa565b9150610a60826109cd565b600b82019150610a7082856109f3565b9150610a7b82610a24565b600982019150610a8b82846109f3565b91508190509392505050565b60006020820190508181036000830152610ab18184610897565b905092915050565b7f4661696c656420746f2073656e64206e617469766520746f6b656e0000000000600082015250565b6000610aef601b8361085c565b9150610afa82610ab9565b602082019050919050565b60006020820190508181036000830152610b1e81610ae2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220537a99126d8c145114145f22552a791dfb3e2b30393022b159f7c2e0d8db2aa064736f6c63430008180033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630a04fd4d1461003b578063a4de557414610057575b600080fd5b610055600480360381019061005091906106e4565b610073565b005b610071600480360381019061006c919061079e565b610195565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016100d4939291906108d0565b6020604051808303816000875af11580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610923565b905081811461012582610333565b61012e84610333565b60405160200161013f929190610a4a565b6040516020818303038152906040529061018f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101869190610a97565b60405180910390fd5b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f1935050505090508061020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020590610b05565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685876040518463ffffffff1660e01b815260040161026f939291906108d0565b6020604051808303816000875af115801561028e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b29190610923565b90508281146102c082610333565b6102c985610333565b6040516020016102da929190610a4a565b6040516020818303038152906040529061032a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103219190610a97565b60405180910390fd5b50505050505050565b60606000600161034284610401565b01905060008167ffffffffffffffff81111561036157610360610583565b5b6040519080825280601f01601f1916602001820160405280156103935781602001600182028036833780820191505090505b509050600082602001820190505b6001156103f6578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816103ea576103e9610b25565b5b049450600085036103a1575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061045f577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161045557610454610b25565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061049c576d04ee2d6d415b85acef8100000000838161049257610491610b25565b5b0492506020810190505b662386f26fc1000083106104cb57662386f26fc1000083816104c1576104c0610b25565b5b0492506010810190505b6305f5e10083106104f4576305f5e10083816104ea576104e9610b25565b5b0492506008810190505b612710831061051957612710838161050f5761050e610b25565b5b0492506004810190505b6064831061053c576064838161053257610531610b25565b5b0492506002810190505b600a831061054b576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105bb82610572565b810181811067ffffffffffffffff821117156105da576105d9610583565b5b80604052505050565b60006105ed610554565b90506105f982826105b2565b919050565b600067ffffffffffffffff82111561061957610618610583565b5b61062282610572565b9050602081019050919050565b82818337600083830152505050565b600061065161064c846105fe565b6105e3565b90508281526020810184848401111561066d5761066c61056d565b5b61067884828561062f565b509392505050565b600082601f83011261069557610694610568565b5b81356106a584826020860161063e565b91505092915050565b6000819050919050565b6106c1816106ae565b81146106cc57600080fd5b50565b6000813590506106de816106b8565b92915050565b600080604083850312156106fb576106fa61055e565b5b600083013567ffffffffffffffff81111561071957610718610563565b5b61072585828601610680565b9250506020610736858286016106cf565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076b82610740565b9050919050565b61077b81610760565b811461078657600080fd5b50565b60008135905061079881610772565b92915050565b600080600080608085870312156107b8576107b761055e565b5b60006107c687828801610789565b94505060206107d7878288016106cf565b935050604085013567ffffffffffffffff8111156107f8576107f7610563565b5b61080487828801610680565b9250506060610815878288016106cf565b91505092959194509250565b600061082c82610740565b9050919050565b61083c81610821565b82525050565b61084b816106ae565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561088b578082015181840152602081019050610870565b60008484015250505050565b60006108a282610851565b6108ac818561085c565b93506108bc81856020860161086d565b6108c581610572565b840191505092915050565b60006060820190506108e56000830186610833565b6108f26020830185610842565b81810360408301526109048184610897565b9050949350505050565b60008151905061091d816106b8565b92915050565b6000602082840312156109395761093861055e565b5b60006109478482850161090e565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109b7603f83610950565b91506109c28261095b565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b60006109fe82610851565b610a088185610950565b9350610a1881856020860161086d565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a55826109aa565b9150610a60826109cd565b600b82019150610a7082856109f3565b9150610a7b82610a24565b600982019150610a8b82846109f3565b91508190509392505050565b60006020820190508181036000830152610ab18184610897565b905092915050565b7f4661696c656420746f2073656e64206e617469766520746f6b656e0000000000600082015250565b6000610aef601b8361085c565b9150610afa82610ab9565b602082019050919050565b60006020820190508181036000830152610b1e81610ae2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220537a99126d8c145114145f22552a791dfb3e2b30393022b159f7c2e0d8db2aa064736f6c63430008180033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/x/evm/embeds/artifacts/contracts/TestPrecompileSelfCallRevert.sol/TestPrecompileSelfCallRevert.json b/x/evm/embeds/artifacts/contracts/TestPrecompileSelfCallRevert.sol/TestPrecompileSelfCallRevert.json index 9f6f671d8..d71d6dfa1 100644 --- a/x/evm/embeds/artifacts/contracts/TestPrecompileSelfCallRevert.sol/TestPrecompileSelfCallRevert.json +++ b/x/evm/embeds/artifacts/contracts/TestPrecompileSelfCallRevert.sol/TestPrecompileSelfCallRevert.json @@ -71,8 +71,8 @@ "type": "function" } ], - "bytecode": "0x60806040526000600155604051610c8e380380610c8e833981810160405281019061002a91906100d3565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610100565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a082610075565b9050919050565b6100b081610095565b81146100bb57600080fd5b50565b6000815190506100cd816100a7565b92915050565b6000602082840312156100e9576100e8610070565b5b60006100f7848285016100be565b91505092915050565b610b7f8061010f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80636ad4fe961461003b578063705964db14610057575b600080fd5b610055600480360381019061005091906106c1565b610073565b005b610071600480360381019061006c91906106c1565b610208565b005b8373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050506100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de906107a1565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016101489392919061085f565b6020604051808303816000875af1158015610167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018b91906108b2565b9050818114610199856102b2565b6101a2846102b2565b6040516020016101b39291906109d9565b60405160208183030381529060405290610203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fa9190610a26565b60405180910390fd5b600080fd5b6001600081548092919061021b90610a77565b91905055503073ffffffffffffffffffffffffffffffffffffffff16636ad4fe96858585856040518563ffffffff1660e01b815260040161025f9493929190610ace565b600060405180830381600087803b15801561027957600080fd5b505af192505050801561028a575060015b6102ab57600160008154809291906102a190610a77565b91905055506102ac565b5b50505050565b6060600060016102c184610380565b01905060008167ffffffffffffffff8111156102e0576102df610596565b5b6040519080825280601f01601f1916602001820160405280156103125781602001600182028036833780820191505090505b509050600082602001820190505b600115610375578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161036957610368610b1a565b5b04945060008503610320575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103de577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103d4576103d3610b1a565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061041b576d04ee2d6d415b85acef8100000000838161041157610410610b1a565b5b0492506020810190505b662386f26fc10000831061044a57662386f26fc1000083816104405761043f610b1a565b5b0492506010810190505b6305f5e1008310610473576305f5e100838161046957610468610b1a565b5b0492506008810190505b612710831061049857612710838161048e5761048d610b1a565b5b0492506004810190505b606483106104bb57606483816104b1576104b0610b1a565b5b0492506002810190505b600a83106104ca576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610512826104e7565b9050919050565b61052281610507565b811461052d57600080fd5b50565b60008135905061053f81610519565b92915050565b6000819050919050565b61055881610545565b811461056357600080fd5b50565b6000813590506105758161054f565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105ce82610585565b810181811067ffffffffffffffff821117156105ed576105ec610596565b5b80604052505050565b60006106006104d3565b905061060c82826105c5565b919050565b600067ffffffffffffffff82111561062c5761062b610596565b5b61063582610585565b9050602081019050919050565b82818337600083830152505050565b600061066461065f84610611565b6105f6565b9050828152602081018484840111156106805761067f610580565b5b61068b848285610642565b509392505050565b600082601f8301126106a8576106a761057b565b5b81356106b8848260208601610651565b91505092915050565b600080600080608085870312156106db576106da6104dd565b5b60006106e987828801610530565b94505060206106fa87828801610566565b935050604085013567ffffffffffffffff81111561071b5761071a6104e2565b5b61072787828801610693565b925050606061073887828801610566565b91505092959194509250565b600082825260208201905092915050565b7f455448207472616e73666572206661696c656400000000000000000000000000600082015250565b600061078b601383610744565b915061079682610755565b602082019050919050565b600060208201905081810360008301526107ba8161077e565b9050919050565b60006107cc826104e7565b9050919050565b6107dc816107c1565b82525050565b6107eb81610545565b82525050565b600081519050919050565b60005b8381101561081a5780820151818401526020810190506107ff565b60008484015250505050565b6000610831826107f1565b61083b8185610744565b935061084b8185602086016107fc565b61085481610585565b840191505092915050565b600060608201905061087460008301866107d3565b61088160208301856107e2565b81810360408301526108938184610826565b9050949350505050565b6000815190506108ac8161054f565b92915050565b6000602082840312156108c8576108c76104dd565b5b60006108d68482850161089d565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b6000610946603f836108df565b9150610951826108ea565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061098d826107f1565b61099781856108df565b93506109a78185602086016107fc565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b60006109e482610939565b91506109ef8261095c565b600b820191506109ff8285610982565b9150610a0a826109b3565b600982019150610a1a8284610982565b91508190509392505050565b60006020820190508181036000830152610a408184610826565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a8282610545565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610ab457610ab3610a48565b5b600182019050919050565b610ac881610507565b82525050565b6000608082019050610ae36000830187610abf565b610af060208301866107e2565b8181036040830152610b028185610826565b9050610b1160608301846107e2565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122025f19b0c686ff339bb4b68de727beee11bc2a0c2b9709bd82cc14c13e1eadbe064736f6c63430008180033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80636ad4fe961461003b578063705964db14610057575b600080fd5b610055600480360381019061005091906106c1565b610073565b005b610071600480360381019061006c91906106c1565b610208565b005b8373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050506100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de906107a1565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016101489392919061085f565b6020604051808303816000875af1158015610167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018b91906108b2565b9050818114610199856102b2565b6101a2846102b2565b6040516020016101b39291906109d9565b60405160208183030381529060405290610203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fa9190610a26565b60405180910390fd5b600080fd5b6001600081548092919061021b90610a77565b91905055503073ffffffffffffffffffffffffffffffffffffffff16636ad4fe96858585856040518563ffffffff1660e01b815260040161025f9493929190610ace565b600060405180830381600087803b15801561027957600080fd5b505af192505050801561028a575060015b6102ab57600160008154809291906102a190610a77565b91905055506102ac565b5b50505050565b6060600060016102c184610380565b01905060008167ffffffffffffffff8111156102e0576102df610596565b5b6040519080825280601f01601f1916602001820160405280156103125781602001600182028036833780820191505090505b509050600082602001820190505b600115610375578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161036957610368610b1a565b5b04945060008503610320575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103de577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103d4576103d3610b1a565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061041b576d04ee2d6d415b85acef8100000000838161041157610410610b1a565b5b0492506020810190505b662386f26fc10000831061044a57662386f26fc1000083816104405761043f610b1a565b5b0492506010810190505b6305f5e1008310610473576305f5e100838161046957610468610b1a565b5b0492506008810190505b612710831061049857612710838161048e5761048d610b1a565b5b0492506004810190505b606483106104bb57606483816104b1576104b0610b1a565b5b0492506002810190505b600a83106104ca576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610512826104e7565b9050919050565b61052281610507565b811461052d57600080fd5b50565b60008135905061053f81610519565b92915050565b6000819050919050565b61055881610545565b811461056357600080fd5b50565b6000813590506105758161054f565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105ce82610585565b810181811067ffffffffffffffff821117156105ed576105ec610596565b5b80604052505050565b60006106006104d3565b905061060c82826105c5565b919050565b600067ffffffffffffffff82111561062c5761062b610596565b5b61063582610585565b9050602081019050919050565b82818337600083830152505050565b600061066461065f84610611565b6105f6565b9050828152602081018484840111156106805761067f610580565b5b61068b848285610642565b509392505050565b600082601f8301126106a8576106a761057b565b5b81356106b8848260208601610651565b91505092915050565b600080600080608085870312156106db576106da6104dd565b5b60006106e987828801610530565b94505060206106fa87828801610566565b935050604085013567ffffffffffffffff81111561071b5761071a6104e2565b5b61072787828801610693565b925050606061073887828801610566565b91505092959194509250565b600082825260208201905092915050565b7f455448207472616e73666572206661696c656400000000000000000000000000600082015250565b600061078b601383610744565b915061079682610755565b602082019050919050565b600060208201905081810360008301526107ba8161077e565b9050919050565b60006107cc826104e7565b9050919050565b6107dc816107c1565b82525050565b6107eb81610545565b82525050565b600081519050919050565b60005b8381101561081a5780820151818401526020810190506107ff565b60008484015250505050565b6000610831826107f1565b61083b8185610744565b935061084b8185602086016107fc565b61085481610585565b840191505092915050565b600060608201905061087460008301866107d3565b61088160208301856107e2565b81810360408301526108938184610826565b9050949350505050565b6000815190506108ac8161054f565b92915050565b6000602082840312156108c8576108c76104dd565b5b60006108d68482850161089d565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b6000610946603f836108df565b9150610951826108ea565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061098d826107f1565b61099781856108df565b93506109a78185602086016107fc565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b60006109e482610939565b91506109ef8261095c565b600b820191506109ff8285610982565b9150610a0a826109b3565b600982019150610a1a8284610982565b91508190509392505050565b60006020820190508181036000830152610a408184610826565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a8282610545565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610ab457610ab3610a48565b5b600182019050919050565b610ac881610507565b82525050565b6000608082019050610ae36000830187610abf565b610af060208301866107e2565b8181036040830152610b028185610826565b9050610b1160608301846107e2565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122025f19b0c686ff339bb4b68de727beee11bc2a0c2b9709bd82cc14c13e1eadbe064736f6c63430008180033", + "bytecode": "0x60806040526000600155604051610c8e380380610c8e833981810160405281019061002a91906100d3565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610100565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a082610075565b9050919050565b6100b081610095565b81146100bb57600080fd5b50565b6000815190506100cd816100a7565b92915050565b6000602082840312156100e9576100e8610070565b5b60006100f7848285016100be565b91505092915050565b610b7f8061010f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80636ad4fe961461003b578063705964db14610057575b600080fd5b610055600480360381019061005091906106c1565b610073565b005b610071600480360381019061006c91906106c1565b610208565b005b8373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050506100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de906107a1565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016101489392919061085f565b6020604051808303816000875af1158015610167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018b91906108b2565b9050818114610199856102b2565b6101a2846102b2565b6040516020016101b39291906109d9565b60405160208183030381529060405290610203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fa9190610a26565b60405180910390fd5b600080fd5b6001600081548092919061021b90610a77565b91905055503073ffffffffffffffffffffffffffffffffffffffff16636ad4fe96858585856040518563ffffffff1660e01b815260040161025f9493929190610ace565b600060405180830381600087803b15801561027957600080fd5b505af192505050801561028a575060015b6102ab57600160008154809291906102a190610a77565b91905055506102ac565b5b50505050565b6060600060016102c184610380565b01905060008167ffffffffffffffff8111156102e0576102df610596565b5b6040519080825280601f01601f1916602001820160405280156103125781602001600182028036833780820191505090505b509050600082602001820190505b600115610375578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161036957610368610b1a565b5b04945060008503610320575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103de577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103d4576103d3610b1a565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061041b576d04ee2d6d415b85acef8100000000838161041157610410610b1a565b5b0492506020810190505b662386f26fc10000831061044a57662386f26fc1000083816104405761043f610b1a565b5b0492506010810190505b6305f5e1008310610473576305f5e100838161046957610468610b1a565b5b0492506008810190505b612710831061049857612710838161048e5761048d610b1a565b5b0492506004810190505b606483106104bb57606483816104b1576104b0610b1a565b5b0492506002810190505b600a83106104ca576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610512826104e7565b9050919050565b61052281610507565b811461052d57600080fd5b50565b60008135905061053f81610519565b92915050565b6000819050919050565b61055881610545565b811461056357600080fd5b50565b6000813590506105758161054f565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105ce82610585565b810181811067ffffffffffffffff821117156105ed576105ec610596565b5b80604052505050565b60006106006104d3565b905061060c82826105c5565b919050565b600067ffffffffffffffff82111561062c5761062b610596565b5b61063582610585565b9050602081019050919050565b82818337600083830152505050565b600061066461065f84610611565b6105f6565b9050828152602081018484840111156106805761067f610580565b5b61068b848285610642565b509392505050565b600082601f8301126106a8576106a761057b565b5b81356106b8848260208601610651565b91505092915050565b600080600080608085870312156106db576106da6104dd565b5b60006106e987828801610530565b94505060206106fa87828801610566565b935050604085013567ffffffffffffffff81111561071b5761071a6104e2565b5b61072787828801610693565b925050606061073887828801610566565b91505092959194509250565b600082825260208201905092915050565b7f455448207472616e73666572206661696c656400000000000000000000000000600082015250565b600061078b601383610744565b915061079682610755565b602082019050919050565b600060208201905081810360008301526107ba8161077e565b9050919050565b60006107cc826104e7565b9050919050565b6107dc816107c1565b82525050565b6107eb81610545565b82525050565b600081519050919050565b60005b8381101561081a5780820151818401526020810190506107ff565b60008484015250505050565b6000610831826107f1565b61083b8185610744565b935061084b8185602086016107fc565b61085481610585565b840191505092915050565b600060608201905061087460008301866107d3565b61088160208301856107e2565b81810360408301526108938184610826565b9050949350505050565b6000815190506108ac8161054f565b92915050565b6000602082840312156108c8576108c76104dd565b5b60006108d68482850161089d565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b6000610946603f836108df565b9150610951826108ea565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061098d826107f1565b61099781856108df565b93506109a78185602086016107fc565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b60006109e482610939565b91506109ef8261095c565b600b820191506109ff8285610982565b9150610a0a826109b3565b600982019150610a1a8284610982565b91508190509392505050565b60006020820190508181036000830152610a408184610826565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a8282610545565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610ab457610ab3610a48565b5b600182019050919050565b610ac881610507565b82525050565b6000608082019050610ae36000830187610abf565b610af060208301866107e2565b8181036040830152610b028185610826565b9050610b1160608301846107e2565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122005e9d030e05589bcbd7f2b8c2c7891d3ff3059be6d273b8aa94f18f14212d30964736f6c63430008180033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80636ad4fe961461003b578063705964db14610057575b600080fd5b610055600480360381019061005091906106c1565b610073565b005b610071600480360381019061006c91906106c1565b610208565b005b8373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050506100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de906107a1565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016101489392919061085f565b6020604051808303816000875af1158015610167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018b91906108b2565b9050818114610199856102b2565b6101a2846102b2565b6040516020016101b39291906109d9565b60405160208183030381529060405290610203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fa9190610a26565b60405180910390fd5b600080fd5b6001600081548092919061021b90610a77565b91905055503073ffffffffffffffffffffffffffffffffffffffff16636ad4fe96858585856040518563ffffffff1660e01b815260040161025f9493929190610ace565b600060405180830381600087803b15801561027957600080fd5b505af192505050801561028a575060015b6102ab57600160008154809291906102a190610a77565b91905055506102ac565b5b50505050565b6060600060016102c184610380565b01905060008167ffffffffffffffff8111156102e0576102df610596565b5b6040519080825280601f01601f1916602001820160405280156103125781602001600182028036833780820191505090505b509050600082602001820190505b600115610375578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161036957610368610b1a565b5b04945060008503610320575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103de577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103d4576103d3610b1a565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061041b576d04ee2d6d415b85acef8100000000838161041157610410610b1a565b5b0492506020810190505b662386f26fc10000831061044a57662386f26fc1000083816104405761043f610b1a565b5b0492506010810190505b6305f5e1008310610473576305f5e100838161046957610468610b1a565b5b0492506008810190505b612710831061049857612710838161048e5761048d610b1a565b5b0492506004810190505b606483106104bb57606483816104b1576104b0610b1a565b5b0492506002810190505b600a83106104ca576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610512826104e7565b9050919050565b61052281610507565b811461052d57600080fd5b50565b60008135905061053f81610519565b92915050565b6000819050919050565b61055881610545565b811461056357600080fd5b50565b6000813590506105758161054f565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105ce82610585565b810181811067ffffffffffffffff821117156105ed576105ec610596565b5b80604052505050565b60006106006104d3565b905061060c82826105c5565b919050565b600067ffffffffffffffff82111561062c5761062b610596565b5b61063582610585565b9050602081019050919050565b82818337600083830152505050565b600061066461065f84610611565b6105f6565b9050828152602081018484840111156106805761067f610580565b5b61068b848285610642565b509392505050565b600082601f8301126106a8576106a761057b565b5b81356106b8848260208601610651565b91505092915050565b600080600080608085870312156106db576106da6104dd565b5b60006106e987828801610530565b94505060206106fa87828801610566565b935050604085013567ffffffffffffffff81111561071b5761071a6104e2565b5b61072787828801610693565b925050606061073887828801610566565b91505092959194509250565b600082825260208201905092915050565b7f455448207472616e73666572206661696c656400000000000000000000000000600082015250565b600061078b601383610744565b915061079682610755565b602082019050919050565b600060208201905081810360008301526107ba8161077e565b9050919050565b60006107cc826104e7565b9050919050565b6107dc816107c1565b82525050565b6107eb81610545565b82525050565b600081519050919050565b60005b8381101561081a5780820151818401526020810190506107ff565b60008484015250505050565b6000610831826107f1565b61083b8185610744565b935061084b8185602086016107fc565b61085481610585565b840191505092915050565b600060608201905061087460008301866107d3565b61088160208301856107e2565b81810360408301526108938184610826565b9050949350505050565b6000815190506108ac8161054f565b92915050565b6000602082840312156108c8576108c76104dd565b5b60006108d68482850161089d565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b6000610946603f836108df565b9150610951826108ea565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061098d826107f1565b61099781856108df565b93506109a78185602086016107fc565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b60006109e482610939565b91506109ef8261095c565b600b820191506109ff8285610982565b9150610a0a826109b3565b600982019150610a1a8284610982565b91508190509392505050565b60006020820190508181036000830152610a408184610826565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a8282610545565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610ab457610ab3610a48565b5b600182019050919050565b610ac881610507565b82525050565b6000608082019050610ae36000830187610abf565b610af060208301866107e2565b8181036040830152610b028185610826565b9050610b1160608301846107e2565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122005e9d030e05589bcbd7f2b8c2c7891d3ff3059be6d273b8aa94f18f14212d30964736f6c63430008180033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/x/evm/embeds/artifacts/contracts/Wasm.sol/IWasm.json b/x/evm/embeds/artifacts/contracts/Wasm.sol/IWasm.json index 61e38453f..a005bfcbb 100644 --- a/x/evm/embeds/artifacts/contracts/Wasm.sol/IWasm.json +++ b/x/evm/embeds/artifacts/contracts/Wasm.sol/IWasm.json @@ -3,6 +3,25 @@ "contractName": "IWasm", "sourceName": "contracts/Wasm.sol", "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "string", + "name": "eventType", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "abciEvent", + "type": "string" + } + ], + "name": "AbciEvent", + "type": "event" + }, { "inputs": [ { @@ -28,7 +47,7 @@ "type": "uint256" } ], - "internalType": "struct IWasm.BankCoin[]", + "internalType": "struct INibiruEvm.BankCoin[]", "name": "funds", "type": "tuple[]" } @@ -71,7 +90,7 @@ "type": "uint256" } ], - "internalType": "struct IWasm.BankCoin[]", + "internalType": "struct INibiruEvm.BankCoin[]", "name": "funds", "type": "tuple[]" } @@ -127,7 +146,7 @@ "type": "uint256" } ], - "internalType": "struct IWasm.BankCoin[]", + "internalType": "struct INibiruEvm.BankCoin[]", "name": "funds", "type": "tuple[]" } diff --git a/x/evm/embeds/contracts/IFunToken.sol b/x/evm/embeds/contracts/IFunToken.sol index 70b130638..7a943ef98 100644 --- a/x/evm/embeds/contracts/IFunToken.sol +++ b/x/evm/embeds/contracts/IFunToken.sol @@ -4,10 +4,12 @@ pragma solidity >=0.8.19; address constant FUNTOKEN_PRECOMPILE_ADDRESS = 0x0000000000000000000000000000000000000800; IFunToken constant FUNTOKEN_PRECOMPILE = IFunToken(FUNTOKEN_PRECOMPILE_ADDRESS); +import "./NibiruEvmUtils.sol"; + /// @dev Implements the functionality for sending ERC20 tokens and bank /// coins to various Nibiru accounts using either the Nibiru Bech32 address /// using the "FunToken" mapping between the ERC20 and bank. -interface IFunToken { +interface IFunToken is INibiruEvm { /// @dev sendToBank sends ERC20 tokens as coins to a Nibiru base account /// @param erc20 - the address of the ERC20 token contract /// @param amount - the amount of tokens to send diff --git a/x/evm/embeds/contracts/NibiruEvmUtils.sol b/x/evm/embeds/contracts/NibiruEvmUtils.sol new file mode 100644 index 000000000..6a3a5b524 --- /dev/null +++ b/x/evm/embeds/contracts/NibiruEvmUtils.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.19; + +/// @notice Interface defining the AbciEvent for interoperability between +/// Ethereum and the ABCI (Application Blockchain Interface). +interface INibiruEvm { + struct BankCoin { + string denom; + uint256 amount; + } + + /// @notice Event emitted to in precompiled contracts to relay information + /// from the ABCI to the EVM logs and indexers. Consumers of this event should + /// decode the `attrs` parameter based on the `eventType` context. + /// + /// @param eventType An identifier type of the event, used for indexing. + /// Event types indexable with CometBFT indexer are in snake case like + /// "pending_ethereum_tx" or "message", while protobuf typed events use the + /// proto message name as their event type (e.g. + /// "eth.evm.v1.EventEthereumTx"). + /// @param abciEvent JSON object string with the event type and fields of an + /// ABCI event. + event AbciEvent(string indexed eventType, string abciEvent); +} diff --git a/x/evm/embeds/contracts/TestInfiniteRecursionERC20.sol b/x/evm/embeds/contracts/TestInfiniteRecursionERC20.sol new file mode 100644 index 000000000..0917f74db --- /dev/null +++ b/x/evm/embeds/contracts/TestInfiniteRecursionERC20.sol @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "./IFunToken.sol"; +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract TestInfiniteRecursionERC20 is ERC20 { + constructor(string memory name, string memory symbol, uint8 decimals_) + ERC20(name, symbol) { + _mint(msg.sender, 1000000 * 10**18); + } + + function balanceOf(address who) public view virtual override returns (uint256) { + // recurse through funtoken.balance(who, address(this)) + address(FUNTOKEN_PRECOMPILE_ADDRESS).staticcall( + abi.encodeWithSignature( + "balance(address,address)", + who, + address(this)) + ); + return 0; + } + + function transfer(address to, uint256 amount) public override returns (bool) { + // recurse through funtoken sendToBank + FUNTOKEN_PRECOMPILE.sendToBank( + address(this), + amount, + "nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl" // does not matter, it's not reached + ); + return true; + } + + function attackBalance() public { + balanceOf(address(0)); + } + + function attackTransfer() public { + transfer(address(0), 1); + } +} diff --git a/x/evm/embeds/contracts/Wasm.sol b/x/evm/embeds/contracts/Wasm.sol index 8a5842062..37ea785df 100644 --- a/x/evm/embeds/contracts/Wasm.sol +++ b/x/evm/embeds/contracts/Wasm.sol @@ -5,69 +5,65 @@ address constant WASM_PRECOMPILE_ADDRESS = 0x00000000000000000000000000000000000 IWasm constant WASM_PRECOMPILE = IWasm(WASM_PRECOMPILE_ADDRESS); -interface IWasm { - struct BankCoin { - string denom; - uint256 amount; - } +import "./NibiruEvmUtils.sol"; - /// @notice Invoke a contract's "ExecuteMsg", which corresponds to - /// "wasm/types/MsgExecuteContract". This enables arbitrary smart contract - /// execution using the Wasm VM from the EVM. - /// @param contractAddr nibi-prefixed Bech32 address of the wasm contract - /// @param msgArgs JSON encoded wasm execute invocation - /// @param funds Optional funds to supply during the execute call. It's - /// uncommon to use this field, so you'll pass an empty array most of the time. - /// @dev The three non-struct arguments are more gas efficient than encoding a - /// single argument as a WasmExecuteMsg. - function execute( - string memory contractAddr, - bytes memory msgArgs, - BankCoin[] memory funds - ) payable external returns (bytes memory response); +interface IWasm is INibiruEvm { + /// @notice Invoke a contract's "ExecuteMsg", which corresponds to + /// "wasm/types/MsgExecuteContract". This enables arbitrary smart contract + /// execution using the Wasm VM from the EVM. + /// @param contractAddr nibi-prefixed Bech32 address of the wasm contract + /// @param msgArgs JSON encoded wasm execute invocation + /// @param funds Optional funds to supply during the execute call. It's + /// uncommon to use this field, so you'll pass an empty array most of the time. + /// @dev The three non-struct arguments are more gas efficient than encoding a + /// single argument as a WasmExecuteMsg. + function execute( + string memory contractAddr, + bytes memory msgArgs, + INibiruEvm.BankCoin[] memory funds + ) external payable returns (bytes memory response); - struct WasmExecuteMsg { - string contractAddr; - bytes msgArgs; - BankCoin[] funds; - } + struct WasmExecuteMsg { + string contractAddr; + bytes msgArgs; + INibiruEvm.BankCoin[] funds; + } - /// @notice Identical to "execute", except for multiple contract calls. - function executeMulti( - WasmExecuteMsg[] memory executeMsgs - ) payable external returns (bytes[] memory responses); + /// @notice Identical to "execute", except for multiple contract calls. + function executeMulti( + WasmExecuteMsg[] memory executeMsgs + ) external payable returns (bytes[] memory responses); - /// @notice Query the public API of another contract at a known address (with - /// known ABI). - /// Implements smart query, the "WasmQuery::Smart" variant from "cosmwas_std". - /// @param contractAddr nibi-prefixed Bech32 address of the wasm contract - /// @param req JSON encoded query request - /// @return response Returns whatever type the contract returns (caller should - /// know), wrapped in a JSON encoded contract result. - function query( - string memory contractAddr, - bytes memory req - ) external view returns (bytes memory response); + /// @notice Query the public API of another contract at a known address (with + /// known ABI). + /// Implements smart query, the "WasmQuery::Smart" variant from "cosmwas_std". + /// @param contractAddr nibi-prefixed Bech32 address of the wasm contract + /// @param req JSON encoded query request + /// @return response Returns whatever type the contract returns (caller should + /// know), wrapped in a JSON encoded contract result. + function query( + string memory contractAddr, + bytes memory req + ) external view returns (bytes memory response); - /// @notice Query the raw kv-store of the contract. - /// Implements raw query, the "WasmQuery::Raw" variant from "cosmwas_std". - /// @param contractAddr nibi-prefixed Bech32 address of the wasm contract - /// @param key contract state key. For example, a `cw_storage_plus::Item` of - /// value `Item::new("state")` creates prefix store with key, "state". - /// @return response JSON encoded, raw data stored at that key. - function queryRaw( - string memory contractAddr, - bytes memory key - ) external view returns (bytes memory response); - - /// @notice InstantiateContract creates a new smart contract instance for the - /// given code id. - function instantiate( - string memory admin, - uint64 codeID, - bytes memory msgArgs, - string memory label, - BankCoin[] memory funds - ) payable external returns (string memory contractAddr, bytes memory data); + /// @notice Query the raw kv-store of the contract. + /// Implements raw query, the "WasmQuery::Raw" variant from "cosmwas_std". + /// @param contractAddr nibi-prefixed Bech32 address of the wasm contract + /// @param key contract state key. For example, a `cw_storage_plus::Item` of + /// value `Item::new("state")` creates prefix store with key, "state". + /// @return response JSON encoded, raw data stored at that key. + function queryRaw( + string memory contractAddr, + bytes memory key + ) external view returns (bytes memory response); + /// @notice InstantiateContract creates a new smart contract instance for the + /// given code id. + function instantiate( + string memory admin, + uint64 codeID, + bytes memory msgArgs, + string memory label, + INibiruEvm.BankCoin[] memory funds + ) external payable returns (string memory contractAddr, bytes memory data); } diff --git a/x/evm/embeds/embeds.go b/x/evm/embeds/embeds.go index b3676de17..448d7d2fd 100644 --- a/x/evm/embeds/embeds.go +++ b/x/evm/embeds/embeds.go @@ -37,6 +37,8 @@ var ( testNativeSendThenPrecompileSendJson []byte //go:embed artifacts/contracts/TestPrecompileSelfCallRevert.sol/TestPrecompileSelfCallRevert.json testPrecompileSelfCallRevertJson []byte + //go:embed artifacts/contracts/TestInfiniteRecursionERC20.sol/TestInfiniteRecursionERC20.json + testInfiniteRecursionERC20Json []byte ) var ( @@ -118,6 +120,12 @@ var ( Name: "TestPrecompileSelfCallRevert.sol", EmbedJSON: testPrecompileSelfCallRevertJson, } + // SmartContract_TestInfiniteRecursionERC20 is a test contract + // which simulates malicious ERC20 behavior by adding infinite recursion in transfer() and balanceOf() functions + SmartContract_TestInfiniteRecursionERC20 = CompiledEvmContract{ + Name: "TestInfiniteRecursionERC20.sol", + EmbedJSON: testInfiniteRecursionERC20Json, + } ) func init() { @@ -132,6 +140,7 @@ func init() { SmartContract_TestNativeSendThenPrecompileSendJson.MustLoad() SmartContract_TestERC20TransferThenPrecompileSend.MustLoad() SmartContract_TestPrecompileSelfCallRevert.MustLoad() + SmartContract_TestInfiniteRecursionERC20.MustLoad() } type CompiledEvmContract struct { diff --git a/x/evm/embeds/embeds_test.go b/x/evm/embeds/embeds_test.go index 91a5bf830..fab0a6457 100644 --- a/x/evm/embeds/embeds_test.go +++ b/x/evm/embeds/embeds_test.go @@ -19,5 +19,6 @@ func TestLoadContracts(t *testing.T) { embeds.SmartContract_TestFunTokenPrecompileLocalGas.MustLoad() embeds.SmartContract_TestNativeSendThenPrecompileSendJson.MustLoad() embeds.SmartContract_TestERC20TransferThenPrecompileSend.MustLoad() + embeds.SmartContract_TestInfiniteRecursionERC20.MustLoad() }) } diff --git a/x/evm/embeds/package-lock.json b/x/evm/embeds/package-lock.json index 806b00fe2..2a45a96b1 100644 --- a/x/evm/embeds/package-lock.json +++ b/x/evm/embeds/package-lock.json @@ -9,7 +9,7 @@ }, "devDependencies": { "@nomicfoundation/hardhat-toolbox": "^5.0.0", - "bun": "^1.1.18", + "bun": "^1.1.30", "hardhat": "^2.22.5" } }, @@ -1599,112 +1599,104 @@ "license": "MIT" }, "node_modules/@oven/bun-darwin-aarch64": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.1.21.tgz", - "integrity": "sha512-n1hZewJPZg5XcubisWDaKn/wLaldgagAWya3ZuMBuFwsz4PnGTeQ7Wl3aBe7XzW6fNUAd+ZIfvfNYBRNv1R7Rw==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.1.30.tgz", + "integrity": "sha512-D07QioP+QXlouvIqQIS+7r2zq4lTNd6he79rhKsRQRZGFf9i3NPu87zspUpCaFEu//DZ35DYTt+5anQpAzpoxA==", "cpu": [ "arm64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@oven/bun-darwin-x64": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.1.21.tgz", - "integrity": "sha512-Vr7tz6UBrtkJ0UMCQBRhKH/JThWxkZWnGAmcGFf8h3zFgMfCaTmmWzB4PSCad1wu+4GCrmVoEG8P7MY8+TmS7w==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.1.30.tgz", + "integrity": "sha512-xZ4gTehS6QwN6bsJfDycCNneKoUMaFUQhQg24bJzXS4JPDxeKg1W7PS5AE+U9apz5Dx6//+D4RwVpAPG2LXt0w==", "cpu": [ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@oven/bun-darwin-x64-baseline": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.1.21.tgz", - "integrity": "sha512-4MhDFYONGIg2MqO56u6H/X9TD3+hbDQpOjlGdl7J0aUiV47b3k7vLn5hENYEjAIBR3g744E23rIw4FQAXakFMw==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.1.30.tgz", + "integrity": "sha512-1kFUCxHx7WuEbLDmqm0m2UKBd3S4Ln6qKQ4gxU4umMLFkmvDJn6PszDruFInxGKFLoTAmbXNYNVWkkG/ekt/Lg==", "cpu": [ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@oven/bun-linux-aarch64": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.1.21.tgz", - "integrity": "sha512-0avxsNle8QOLsDwo1lqO1o2Mv1bLp3RlVr83XNV2yGVnzCwZmupQcI76fcc2e+Y+YU173xCUasMkiIbguS271g==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.1.30.tgz", + "integrity": "sha512-SfHHLlph6fptDXyyChcUkeDbEZr2ww1p2BucV6OrvzwTOPi8pVmXA4360YT8ggR/3AHPp4GO36VaD+FU2Ocbxw==", "cpu": [ "arm64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@oven/bun-linux-x64": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.1.21.tgz", - "integrity": "sha512-zmps8oWLE2L+9Cn6oQPbcxIWDIjOT1txbYAv9zlcd84I12DXiB++e/PEE8dPe/3powygCpwZM9b7gZfTv9sx0w==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.1.30.tgz", + "integrity": "sha512-1mC39jQSaECytEKAZdCZmv3ZreMsp7aoxnBwmJtVd2Z7urnw17PKi4dKkZd/R+AubsNYtXtW4jeM8SEa5sUJRw==", "cpu": [ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@oven/bun-linux-x64-baseline": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.1.21.tgz", - "integrity": "sha512-HT+PEWa2PY73gBrNuUHrihsGNOBQKp6s6IzAqHUfmDlIyXYaEvRYUZg6vEqyRRSuNcCC6PiQDHWZP99OT2VMZg==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.1.30.tgz", + "integrity": "sha512-/b/VuNOaAYmsVk9MvfwKcCYARJPUg78hebxNyD5DSajAf3dqtUSnf7QYcq/3mxWH++N+gM7uRTrGksGS63+ZUw==", "cpu": [ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@oven/bun-windows-x64": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64/-/bun-windows-x64-1.1.21.tgz", - "integrity": "sha512-p9rjwZPiJJtBafJ7MoJvmqyCA4QxVVpM7QaDx6Lhqua7b+i7dsigog8BgeCxGXAMpSKqoBuAuziqnLh0pcdAYQ==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64/-/bun-windows-x64-1.1.30.tgz", + "integrity": "sha512-mdRjNtD9NIA8CiH6N1zrIVE6oAtDko/c29H1s00UA+5O/WhXhg95G8IyInD8hN3vAEz8H2lGBgLG2EGfSFxnGg==", "cpu": [ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@oven/bun-windows-x64-baseline": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64-baseline/-/bun-windows-x64-baseline-1.1.21.tgz", - "integrity": "sha512-xwPqSrcdSAJVmCnDlpvEWVHDSf9lmCBIcL5PtM9udrqTJOAVxiyQm0cpXjuv/h6MAZxt7rtt9YqrcK0ixA2xIQ==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64-baseline/-/bun-windows-x64-baseline-1.1.30.tgz", + "integrity": "sha512-ERQ4/ogzbFvHjpyHcnruc8bnryvDvUoiWi6vczfQ4M/idJc+Kg5VSEJiF5k7946rIZGamG6QWgRxtpIglD4/Zw==", "cpu": [ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "win32" @@ -2660,16 +2652,15 @@ "license": "MIT" }, "node_modules/bun": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/bun/-/bun-1.1.21.tgz", - "integrity": "sha512-mvqYEvafGskIVTjlftbKvsXtyR6z/SQnhJsVw0xCU46pc56oX1sAGvaemWKOy/sy/gGMHcgLE0KUidDQQzqXWQ==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/bun/-/bun-1.1.30.tgz", + "integrity": "sha512-ysRL1pq10Xba0jqVLPrKU3YIv0ohfp3cTajCPtpjCyppbn3lfiAVNpGoHfyaxS17OlPmWmR67UZRPw/EueQuug==", "cpu": [ "arm64", "x64" ], "dev": true, "hasInstallScript": true, - "license": "MIT", "os": [ "darwin", "linux", @@ -2680,14 +2671,14 @@ "bunx": "bin/bun.exe" }, "optionalDependencies": { - "@oven/bun-darwin-aarch64": "1.1.21", - "@oven/bun-darwin-x64": "1.1.21", - "@oven/bun-darwin-x64-baseline": "1.1.21", - "@oven/bun-linux-aarch64": "1.1.21", - "@oven/bun-linux-x64": "1.1.21", - "@oven/bun-linux-x64-baseline": "1.1.21", - "@oven/bun-windows-x64": "1.1.21", - "@oven/bun-windows-x64-baseline": "1.1.21" + "@oven/bun-darwin-aarch64": "1.1.30", + "@oven/bun-darwin-x64": "1.1.30", + "@oven/bun-darwin-x64-baseline": "1.1.30", + "@oven/bun-linux-aarch64": "1.1.30", + "@oven/bun-linux-x64": "1.1.30", + "@oven/bun-linux-x64-baseline": "1.1.30", + "@oven/bun-windows-x64": "1.1.30", + "@oven/bun-windows-x64-baseline": "1.1.30" } }, "node_modules/bytes": { diff --git a/x/evm/embeds/package.json b/x/evm/embeds/package.json index 09a8e3c45..3f0a14b72 100644 --- a/x/evm/embeds/package.json +++ b/x/evm/embeds/package.json @@ -1,7 +1,7 @@ { "devDependencies": { "@nomicfoundation/hardhat-toolbox": "^5.0.0", - "bun": "^1.1.18", + "bun": "^1.1.30", "hardhat": "^2.22.5" }, "dependencies": { diff --git a/x/evm/evmtest/evmante.go b/x/evm/evmtest/evmante.go index 54788d1a8..005c88b35 100644 --- a/x/evm/evmtest/evmante.go +++ b/x/evm/evmtest/evmante.go @@ -41,22 +41,22 @@ func NonEvmMsgTx(deps *TestDeps) sdk.Tx { ToAddress: NewEthPrivAcc().NibiruAddr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin("unibi", 1)), } - return buildTx(deps, true, msg, gasLimit, fees) + return BuildTx(deps, true, gasLimit, fees, msg) } -func buildTx( +func BuildTx( deps *TestDeps, ethExtentions bool, - msg sdk.Msg, gasLimit uint64, fees sdk.Coins, + msgs ...sdk.Msg, ) sdk.FeeTx { txBuilder, _ := deps.EncCfg.TxConfig.NewTxBuilder().(authtx.ExtensionOptionsTxBuilder) if ethExtentions { option, _ := codectypes.NewAnyWithValue(&evm.ExtensionOptionsEthereumTx{}) txBuilder.SetExtensionOptions(option) } - err := txBuilder.SetMsgs(msg) + err := txBuilder.SetMsgs(msgs...) if err != nil { panic(err) } diff --git a/x/evm/evmtest/tx.go b/x/evm/evmtest/tx.go index 25bba83f6..d68d16621 100644 --- a/x/evm/evmtest/tx.go +++ b/x/evm/evmtest/tx.go @@ -209,33 +209,50 @@ func GenerateEthTxMsgAndSigner( return evmTxMsg, gethSigner, sender.KeyringSigner, nil } -func TransferWei( - deps *TestDeps, - to gethcommon.Address, - amountWei *big.Int, -) error { +type TxTransferWei struct { + Deps *TestDeps + To gethcommon.Address + AmountWei *big.Int + GasLimit uint64 +} + +func (tx TxTransferWei) Build() (evmTxMsg *evm.MsgEthereumTx, err error) { + gasLimit := tx.GasLimit + if tx.GasLimit == 0 { + gasLimit = gethparams.TxGas + } + deps, to, amountWei := tx.Deps, tx.To, tx.AmountWei + ethAcc := deps.Sender var innerTxData []byte = nil var accessList gethcore.AccessList = nil - ethTxMsg, err := NewEthTxMsgFromTxData( + evmTxMsg, err = NewEthTxMsgFromTxData( deps, gethcore.LegacyTxType, innerTxData, deps.NewStateDB().GetNonce(ethAcc.EthAddr), &to, amountWei, - gethparams.TxGas, + gasLimit, accessList, ) if err != nil { - return fmt.Errorf("error while transferring wei: %w", err) + err = fmt.Errorf("error building tx: %w", err) } + return +} - _, err = deps.App.EvmKeeper.EthereumTx(sdk.WrapSDKContext(deps.Ctx), ethTxMsg) +func (tx TxTransferWei) Run() (evmResp *evm.MsgEthereumTxResponse, err error) { + deps := tx.Deps + evmTxMsg, err := tx.Build() + if err != nil { + return + } + evmResp, err = deps.App.EvmKeeper.EthereumTx(sdk.WrapSDKContext(deps.Ctx), evmTxMsg) if err != nil { - return fmt.Errorf("error while transferring wei: %w", err) + err = fmt.Errorf("error while transferring wei: %w", err) } - return err + return evmResp, err } // -------------------------------------------------- diff --git a/x/evm/evmtest/tx_test.go b/x/evm/evmtest/tx_test.go index e9cc956c1..33e2e7140 100644 --- a/x/evm/evmtest/tx_test.go +++ b/x/evm/evmtest/tx_test.go @@ -77,8 +77,13 @@ func (s *Suite) TestTransferWei() { randomAcc := evmtest.NewEthPrivAcc() to := randomAcc.EthAddr - err := evmtest.TransferWei(&deps, to, evm.NativeToWei(big.NewInt(420))) - s.Require().NoError(err) + evmResp, err := evmtest.TxTransferWei{ + Deps: &deps, + To: to, + AmountWei: evm.NativeToWei(big.NewInt(420)), + }.Run() + s.Require().NoErrorf(err, "%#v", evmResp) + s.False(evmResp.Failed(), "%#v", evmResp) evmtest.AssertBankBalanceEqual( s.T(), deps, evm.EVMBankDenom, deps.Sender.EthAddr, big.NewInt(69_000), diff --git a/x/evm/keeper/bank_extension.go b/x/evm/keeper/bank_extension.go index cb94ccc59..7a14b1db2 100644 --- a/x/evm/keeper/bank_extension.go +++ b/x/evm/keeper/bank_extension.go @@ -1,7 +1,7 @@ package keeper import ( - storetypes "github.com/cosmos/cosmos-sdk/store/types" + store "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" auth "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -34,15 +34,19 @@ func (bk NibiruBankKeeper) MintCoins( moduleName string, coins sdk.Coins, ) error { - // Use the embedded function from [bankkeeper.Keeper] - if err := bk.BaseKeeper.MintCoins(ctx, moduleName, coins); err != nil { - return err - } - if findEtherBalanceChangeFromCoins(coins) { - moduleBech32Addr := auth.NewModuleAddress(moduleName) - bk.SyncStateDBWithAccount(ctx, moduleBech32Addr) - } - return nil + return bk.ForceGasInvariant( + ctx, + func(ctx sdk.Context) error { + // Use the embedded function from [bankkeeper.Keeper] + return bk.BaseKeeper.MintCoins(ctx, moduleName, coins) + }, + func(ctx sdk.Context) { + if findEtherBalanceChangeFromCoins(coins) { + moduleBech32Addr := auth.NewModuleAddress(moduleName) + bk.SyncStateDBWithAccount(ctx, moduleBech32Addr) + } + }, + ) } func (bk NibiruBankKeeper) BurnCoins( @@ -50,32 +54,103 @@ func (bk NibiruBankKeeper) BurnCoins( moduleName string, coins sdk.Coins, ) error { - // Use the embedded function from [bankkeeper.Keeper] - if err := bk.BaseKeeper.BurnCoins(ctx, moduleName, coins); err != nil { + return bk.ForceGasInvariant( + ctx, + func(ctx sdk.Context) error { + // Use the embedded function from [bankkeeper.Keeper] + return bk.BaseKeeper.BurnCoins(ctx, moduleName, coins) + }, + func(ctx sdk.Context) { + if findEtherBalanceChangeFromCoins(coins) { + moduleBech32Addr := auth.NewModuleAddress(moduleName) + bk.SyncStateDBWithAccount(ctx, moduleBech32Addr) + } + }, + ) +} + +// Each Send* operation on the [NibiruBankKeeper] can be described as having a +// base operation (BaseOp) where the [bankkeeper.BaseKeeper] executes some +// business logic and an operation that occurs afterward (AfterOp), where we +// post-process and provide automatic alignment with the EVM [statedb.StateDB]. +// +// Each "AfterOp" tends to consume a negligible amount of gas (<2000 gas), while +// a each "BaseOp" is around 27000 for a single coin transfer. +// +// Although each "AfterOp" consumes a negligible amount of gas, that +// amount of gas consumed is nonzero and depends on whether the current bank +// transaction message occurs within an Ethereum tx or not. +// +// Consistent gas consumption independent of status of the EVM StateDB is brought +// about in [ForceGasInvariant] by consuming only the gas used for the BaseOp. +// This makes sure that post-processing for the EVM [statedb.StateDB] will not +// result in nondeterminism. +func (bk NibiruBankKeeper) ForceGasInvariant( + ctx sdk.Context, + BaseOp func(ctx sdk.Context) error, + AfterOp func(ctx sdk.Context), +) error { + // Assign vars for the tx gas meter + gasMeterBefore := ctx.GasMeter() // Tx gas meter MUST be defined + gasConsumedBefore := gasMeterBefore.GasConsumed() + // Don't modify the "ctx.BlockGasMeter()" directly because this is + // handled in "BaseApp.runTx" + + // Start baseGasConsumed at 0 in case we panic before BaseOp completes and + // baseGasConsumed gets a value assignment + baseOpGasConsumed := uint64(0) + + defer func() { + gasMeterBefore.RefundGas(gasMeterBefore.GasConsumed(), "") + gasMeterBefore.ConsumeGas(gasConsumedBefore+baseOpGasConsumed, "NibiruBankKeeper invariant") + }() + + // Note that because the ctx gas meter uses private variables to track gas, + // we have to branch off with a new gas meter instance to avoid mutating the + // "true" gas meter (called GasMeterBefore here). + ctx = ctx. + WithGasMeter(sdk.NewGasMeter(gasMeterBefore.Limit())). + WithKVGasConfig(zeroCostGasConfig). + WithTransientKVGasConfig(zeroCostGasConfig) + + err := BaseOp(ctx) + baseOpGasConsumed = ctx.GasMeter().GasConsumed() + if err != nil { return err } - if findEtherBalanceChangeFromCoins(coins) { - moduleBech32Addr := auth.NewModuleAddress(moduleName) - bk.SyncStateDBWithAccount(ctx, moduleBech32Addr) - } + + AfterOp(ctx) return nil } +var zeroCostGasConfig store.GasConfig = store.GasConfig{ + HasCost: 0, + DeleteCost: 0, + ReadCostFlat: 0, + ReadCostPerByte: 0, + WriteCostFlat: 0, + WriteCostPerByte: 0, + IterNextCostFlat: 0, +} + func (bk NibiruBankKeeper) SendCoins( ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, coins sdk.Coins, ) error { - // Use the embedded function from [bankkeeper.Keeper] - if err := bk.BaseKeeper.SendCoins(ctx, fromAddr, toAddr, coins); err != nil { - return err - } - if findEtherBalanceChangeFromCoins(coins) { - bk.SyncStateDBWithAccount(ctx, fromAddr) - bk.SyncStateDBWithAccount(ctx, toAddr) - } - return nil + return bk.ForceGasInvariant( + ctx, + func(ctx sdk.Context) error { + return bk.BaseKeeper.SendCoins(ctx, fromAddr, toAddr, coins) + }, + func(ctx sdk.Context) { + if findEtherBalanceChangeFromCoins(coins) { + bk.SyncStateDBWithAccount(ctx, fromAddr) + bk.SyncStateDBWithAccount(ctx, toAddr) + } + }, + ) } func (bk *NibiruBankKeeper) SyncStateDBWithAccount( @@ -86,13 +161,6 @@ func (bk *NibiruBankKeeper) SyncStateDBWithAccount( return } - cachedGasConfig := ctx.KVGasConfig() - defer func() { - ctx = ctx.WithKVGasConfig(cachedGasConfig) - }() - - // set gas cost to zero for this conditional operation - ctx = ctx.WithKVGasConfig(storetypes.GasConfig{}) balanceWei := evm.NativeToWei( bk.GetBalance(ctx, acc, evm.EVMBankDenom).Amount.BigInt(), ) @@ -114,16 +182,20 @@ func (bk NibiruBankKeeper) SendCoinsFromAccountToModule( recipientModule string, coins sdk.Coins, ) error { - // Use the embedded function from [bankkeeper.Keeper] - if err := bk.BaseKeeper.SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, coins); err != nil { - return err - } - if findEtherBalanceChangeFromCoins(coins) { - bk.SyncStateDBWithAccount(ctx, senderAddr) - moduleBech32Addr := auth.NewModuleAddress(recipientModule) - bk.SyncStateDBWithAccount(ctx, moduleBech32Addr) - } - return nil + return bk.ForceGasInvariant( + ctx, + func(ctx sdk.Context) error { + // Use the embedded function from [bankkeeper.Keeper] + return bk.BaseKeeper.SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, coins) + }, + func(ctx sdk.Context) { + if findEtherBalanceChangeFromCoins(coins) { + bk.SyncStateDBWithAccount(ctx, senderAddr) + moduleBech32Addr := auth.NewModuleAddress(recipientModule) + bk.SyncStateDBWithAccount(ctx, moduleBech32Addr) + } + }, + ) } func (bk NibiruBankKeeper) SendCoinsFromModuleToAccount( @@ -132,16 +204,20 @@ func (bk NibiruBankKeeper) SendCoinsFromModuleToAccount( recipientAddr sdk.AccAddress, coins sdk.Coins, ) error { - // Use the embedded function from [bankkeeper.Keeper] - if err := bk.BaseKeeper.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, coins); err != nil { - return err - } - if findEtherBalanceChangeFromCoins(coins) { - moduleBech32Addr := auth.NewModuleAddress(senderModule) - bk.SyncStateDBWithAccount(ctx, moduleBech32Addr) - bk.SyncStateDBWithAccount(ctx, recipientAddr) - } - return nil + return bk.ForceGasInvariant( + ctx, + func(ctx sdk.Context) error { + // Use the embedded function from [bankkeeper.Keeper] + return bk.BaseKeeper.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, coins) + }, + func(ctx sdk.Context) { + if findEtherBalanceChangeFromCoins(coins) { + moduleBech32Addr := auth.NewModuleAddress(senderModule) + bk.SyncStateDBWithAccount(ctx, moduleBech32Addr) + bk.SyncStateDBWithAccount(ctx, recipientAddr) + } + }, + ) } func (bk NibiruBankKeeper) SendCoinsFromModuleToModule( @@ -150,15 +226,19 @@ func (bk NibiruBankKeeper) SendCoinsFromModuleToModule( recipientModule string, coins sdk.Coins, ) error { - // Use the embedded function from [bankkeeper.Keeper] - if err := bk.BaseKeeper.SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, coins); err != nil { - return err - } - if findEtherBalanceChangeFromCoins(coins) { - senderBech32Addr := auth.NewModuleAddress(senderModule) - recipientBech32Addr := auth.NewModuleAddress(recipientModule) - bk.SyncStateDBWithAccount(ctx, senderBech32Addr) - bk.SyncStateDBWithAccount(ctx, recipientBech32Addr) - } - return nil + return bk.ForceGasInvariant( + ctx, + func(ctx sdk.Context) error { + // Use the embedded function from [bankkeeper.Keeper] + return bk.BaseKeeper.SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, coins) + }, + func(ctx sdk.Context) { + if findEtherBalanceChangeFromCoins(coins) { + senderBech32Addr := auth.NewModuleAddress(senderModule) + recipientBech32Addr := auth.NewModuleAddress(recipientModule) + bk.SyncStateDBWithAccount(ctx, senderBech32Addr) + bk.SyncStateDBWithAccount(ctx, recipientBech32Addr) + } + }, + ) } diff --git a/x/evm/keeper/bank_extension_test.go b/x/evm/keeper/bank_extension_test.go new file mode 100644 index 000000000..378bb8546 --- /dev/null +++ b/x/evm/keeper/bank_extension_test.go @@ -0,0 +1,443 @@ +package keeper_test + +import ( + "encoding/json" + "fmt" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + staking "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common/hexutil" + gethparams "github.com/ethereum/go-ethereum/params" + "github.com/rs/zerolog/log" + + "github.com/NibiruChain/nibiru/v2/x/common/testutil/testapp" + "github.com/NibiruChain/nibiru/v2/x/evm" + "github.com/NibiruChain/nibiru/v2/x/evm/embeds" + "github.com/NibiruChain/nibiru/v2/x/evm/evmtest" + "github.com/NibiruChain/nibiru/v2/x/evm/statedb" +) + +// TestGasConsumedInvariantSend: The "NibiruBankKeeper" is defined such that +// send operations are meant to have consistent gas consumption regardless of the +// whether the active "StateDB" instance is defined or undefined (nil). This is +// important to prevent consensus failures resulting from nodes reaching an +// inconsistent state after processing the same state transitions and gettng +// conflicting gas results. +func (s *Suite) TestGasConsumedInvariantSend() { + to := evmtest.NewEthPrivAcc() // arbitrary constant + + testCases := []struct { + GasConsumedInvariantScenario + name string + }{ + { + name: "StateDB nil", + GasConsumedInvariantScenario: GasConsumedInvariantScenario{ + BankDenom: evm.EVMBankDenom, + NilStateDB: true, + }, + }, + + { + name: "StateDB defined", + GasConsumedInvariantScenario: GasConsumedInvariantScenario{ + BankDenom: evm.EVMBankDenom, + NilStateDB: false, + }, + }, + + { + name: "StateDB nil, uniba", + GasConsumedInvariantScenario: GasConsumedInvariantScenario{ + BankDenom: "uniba", + NilStateDB: true, + }, + }, + } + + s.T().Log("Check that gas consumption is equal in all scenarios") + var first uint64 + for idx, tc := range testCases { + s.Run(tc.name, func() { + gasConsumed := tc.GasConsumedInvariantScenario.Run(s, to) + if idx == 0 { + first = gasConsumed + return + } + // Each elem being equal to "first" implies that each elem is equal + s.Equalf( + fmt.Sprintf("%d", first), + fmt.Sprintf("%d", gasConsumed), + "Gas consumed should be equal", + ) + }) + } +} + +type GasConsumedInvariantScenario struct { + BankDenom string + NilStateDB bool +} + +func (scenario GasConsumedInvariantScenario) Run( + s *Suite, + to evmtest.EthPrivKeyAcc, +) (gasConsumed uint64) { + bankDenom, nilStateDB := scenario.BankDenom, scenario.NilStateDB + deps := evmtest.NewTestDeps() + if nilStateDB { + s.Require().Nil(deps.EvmKeeper.Bank.StateDB) + } else { + deps.NewStateDB() + s.NotNil(deps.EvmKeeper.Bank.StateDB) + } + + sendCoins := sdk.NewCoins(sdk.NewInt64Coin(bankDenom, 420)) + s.NoError( + testapp.FundAccount(deps.App.BankKeeper, deps.Ctx, deps.Sender.NibiruAddr, sendCoins), + ) + + gasConsumedBefore := deps.Ctx.GasMeter().GasConsumed() + s.NoError( + deps.App.BankKeeper.SendCoins( + deps.Ctx, deps.Sender.NibiruAddr, to.NibiruAddr, sendCoins, + ), + ) + gasConsumedAfter := deps.Ctx.GasMeter().GasConsumed() + + s.GreaterOrEqualf(gasConsumedAfter, gasConsumedBefore, + "gas meter consumed should not be negative: gas consumed after = %d, gas consumed before = %d ", + gasConsumedAfter, gasConsumedBefore, + ) + + return gasConsumedAfter - gasConsumedBefore +} + +func (s *Suite) TestGasConsumedInvariantSendNotNibi() { + to := evmtest.NewEthPrivAcc() // arbitrary constant + + testCases := []struct { + GasConsumedInvariantScenario + name string + }{ + { + name: "StateDB nil A", + GasConsumedInvariantScenario: GasConsumedInvariantScenario{ + BankDenom: "dummy_token_A", + NilStateDB: true, + }, + }, + + { + name: "StateDB defined A", + GasConsumedInvariantScenario: GasConsumedInvariantScenario{ + BankDenom: "dummy_token_A", + NilStateDB: false, + }, + }, + + { + name: "StateDB nil B", + GasConsumedInvariantScenario: GasConsumedInvariantScenario{ + BankDenom: "dummy_token_B", + NilStateDB: true, + }, + }, + + { + name: "StateDB defined B", + GasConsumedInvariantScenario: GasConsumedInvariantScenario{ + BankDenom: "dummy_token_B", + NilStateDB: false, + }, + }, + } + + s.T().Log("Check that gas consumption is equal in all scenarios") + var first uint64 + for idx, tc := range testCases { + s.Run(tc.name, func() { + gasConsumed := tc.GasConsumedInvariantScenario.Run(s, to) + if idx == 0 { + first = gasConsumed + return + } + // Each elem being equal to "first" implies that each elem is equal + s.Equalf( + fmt.Sprintf("%d", first), + fmt.Sprintf("%d", gasConsumed), + "Gas consumed should be equal", + ) + }) + } +} + +type FunctionalGasConsumedInvariantScenario struct { + Setup func(deps *evmtest.TestDeps) + Measure func(deps *evmtest.TestDeps) +} + +func (f FunctionalGasConsumedInvariantScenario) Run(s *Suite) { + var ( + gasConsumedA uint64 // nil StateDB + gasConsumedB uint64 // not nil StateDB + ) + + { + deps := evmtest.NewTestDeps() + s.Nil(deps.EvmKeeper.Bank.StateDB) + + f.Setup(&deps) + + gasConsumedBefore := deps.Ctx.GasMeter().GasConsumed() + f.Measure(&deps) + gasConsumedAfter := deps.Ctx.GasMeter().GasConsumed() + gasConsumedA = gasConsumedAfter - gasConsumedBefore + } + + { + deps := evmtest.NewTestDeps() + deps.NewStateDB() + s.NotNil(deps.EvmKeeper.Bank.StateDB) + + f.Setup(&deps) + + gasConsumedBefore := deps.Ctx.GasMeter().GasConsumed() + f.Measure(&deps) + gasConsumedAfter := deps.Ctx.GasMeter().GasConsumed() + gasConsumedB = gasConsumedAfter - gasConsumedBefore + } + + s.Equalf( + fmt.Sprintf("%d", gasConsumedA), + fmt.Sprintf("%d", gasConsumedB), + "Gas consumed should be equal", + ) +} + +// See [Suite.TestGasConsumedInvariantSend]. +func (s *Suite) TestGasConsumedInvariantOther() { + to := evmtest.NewEthPrivAcc() // arbitrary constant + bankDenom := evm.EVMBankDenom + coins := sdk.NewCoins(sdk.NewInt64Coin(bankDenom, 420)) // arbitrary constant + // Use this value because the gas token is involved in both the BaseOp and + // AfterOp of the "ForceGasInvariant" function. + s.Run("MintCoins", func() { + FunctionalGasConsumedInvariantScenario{ + Setup: func(deps *evmtest.TestDeps) { + s.NoError( + testapp.FundAccount(deps.App.BankKeeper, deps.Ctx, deps.Sender.NibiruAddr, coins), + ) + }, + Measure: func(deps *evmtest.TestDeps) { + s.NoError( + deps.App.BankKeeper.MintCoins( + deps.Ctx, evm.ModuleName, coins, + ), + ) + }, + }.Run(s) + }) + + s.Run("BurnCoins", func() { + FunctionalGasConsumedInvariantScenario{ + Setup: func(deps *evmtest.TestDeps) { + s.NoError( + testapp.FundModuleAccount(deps.App.BankKeeper, deps.Ctx, evm.ModuleName, coins), + ) + }, + Measure: func(deps *evmtest.TestDeps) { + s.NoError( + deps.App.BankKeeper.BurnCoins( + deps.Ctx, evm.ModuleName, coins, + ), + ) + }, + }.Run(s) + }) + + s.Run("SendCoinsFromAccountToModule", func() { + FunctionalGasConsumedInvariantScenario{ + Setup: func(deps *evmtest.TestDeps) { + s.NoError( + testapp.FundAccount(deps.App.BankKeeper, deps.Ctx, deps.Sender.NibiruAddr, coins), + ) + }, + Measure: func(deps *evmtest.TestDeps) { + s.NoError( + deps.App.BankKeeper.SendCoinsFromAccountToModule( + deps.Ctx, deps.Sender.NibiruAddr, evm.ModuleName, coins, + ), + ) + }, + }.Run(s) + }) + + s.Run("SendCoinsFromModuleToAccount", func() { + FunctionalGasConsumedInvariantScenario{ + Setup: func(deps *evmtest.TestDeps) { + s.NoError( + testapp.FundModuleAccount(deps.App.BankKeeper, deps.Ctx, evm.ModuleName, coins), + ) + }, + Measure: func(deps *evmtest.TestDeps) { + s.NoError( + deps.App.BankKeeper.SendCoinsFromModuleToAccount( + deps.Ctx, evm.ModuleName, to.NibiruAddr, coins, + ), + ) + }, + }.Run(s) + }) + + s.Run("SendCoinsFromModuleToModule", func() { + FunctionalGasConsumedInvariantScenario{ + Setup: func(deps *evmtest.TestDeps) { + s.NoError( + testapp.FundModuleAccount(deps.App.BankKeeper, deps.Ctx, evm.ModuleName, coins), + ) + }, + Measure: func(deps *evmtest.TestDeps) { + s.NoError( + deps.App.BankKeeper.SendCoinsFromModuleToModule( + deps.Ctx, evm.ModuleName, staking.NotBondedPoolName, coins, + ), + ) + }, + }.Run(s) + }) +} + +// TestStateDBReadonlyInvariant: The EVM Keeper's "ApplyEvmMsg" function is used +// in both queries and transaction messages. Queries such as "eth_call", +// "eth_estimateGas", "debug_traceTransaction", "debugTraceCall", and +// "debug_traceBlock" interact with the EVM StateDB inside of "ApplyEvmMsg". +// +// Queries MUST NOT result in lingering effects on the blockchain multistore or +// the keepers, as doing so would result in potential inconsistencies between +// nodes and consensus failures. This test adds cases to make sure that invariant +// is held. +func (s *Suite) TestStateDBReadonlyInvariant() { + deps := evmtest.NewTestDeps() + _, _, erc20Contract := evmtest.DeployAndExecuteERC20Transfer(&deps, s.T()) + to := evmtest.NewEthPrivAcc() + + type StateDBWithExplanation struct { + StateDB *statedb.StateDB + Explanation string + ExpectEqual bool + } + + var stateDBs []StateDBWithExplanation + stateDBs = append(stateDBs, StateDBWithExplanation{ + StateDB: deps.App.EvmKeeper.Bank.StateDB, + Explanation: "initial DB after some EthereumTx", + ExpectEqual: true, + }) + resetBank := func(deps *evmtest.TestDeps) { + deps.App.EvmKeeper.Bank.StateDB = stateDBs[0].StateDB + } + + s.T().Log("eth_call") + { + fungibleTokenContract := embeds.SmartContract_ERC20Minter + jsonTxArgs, err := json.Marshal(&evm.JsonTxArgs{ + From: &deps.Sender.EthAddr, + Data: (*hexutil.Bytes)(&fungibleTokenContract.Bytecode), + }) + s.Require().NoError(err) + req := &evm.EthCallRequest{Args: jsonTxArgs} + _, err = deps.EvmKeeper.EthCall(deps.GoCtx(), req) + s.Require().NoError(err) + stateDBs = append(stateDBs, StateDBWithExplanation{ + StateDB: deps.App.EvmKeeper.Bank.StateDB, + Explanation: "DB after eth_call query", + ExpectEqual: true, + }) + } + + s.T().Log(`EthereumTx success, err == nil, vmError="insufficient balance for transfer"`) + { + balOfSender := deps.App.BankKeeper.GetBalance( + deps.Ctx, deps.Sender.NibiruAddr, evm.EVMBankDenom) + tooManyTokensWei := evm.NativeToWei(balOfSender.Amount.AddRaw(420).BigInt()) + evmResp, err := evmtest.TxTransferWei{ + Deps: &deps, + To: to.EthAddr, + AmountWei: tooManyTokensWei, + }.Run() + s.Require().NoErrorf(err, "%#v", evmResp) + s.Require().Contains(evmResp.VmError, "insufficient balance for transfer") + stateDBs = append(stateDBs, StateDBWithExplanation{ + StateDB: deps.App.EvmKeeper.Bank.StateDB, + Explanation: "DB after EthereumTx with vmError", + ExpectEqual: false, + }) + } + + resetBank(&deps) + stateDBs = append(stateDBs, StateDBWithExplanation{ + StateDB: deps.App.EvmKeeper.Bank.StateDB, + Explanation: "sanity check with original ctx", + ExpectEqual: true, + }) + + s.T().Log(`EthereumTx success, err == nil, no vmError"`) + { + sendCoins := sdk.NewCoins(sdk.NewInt64Coin(evm.EVMBankDenom, 420)) + s.NoError( + testapp.FundAccount(deps.App.BankKeeper, deps.Ctx, deps.Sender.NibiruAddr, sendCoins), + ) + + ctx := deps.Ctx + log.Log().Msgf("ctx.GasMeter().GasConsumed() %d", ctx.GasMeter().GasConsumed()) + log.Log().Msgf("ctx.GasMeter().Limit() %d", ctx.GasMeter().Limit()) + + wei := evm.NativeToWei(sendCoins[0].Amount.BigInt()) + evmResp, err := evmtest.TxTransferWei{ + Deps: &deps, + To: to.EthAddr, + AmountWei: wei, + }.Run() + + s.Require().NoErrorf(err, "%#v", evmResp) + s.Require().Falsef(evmResp.Failed(), "%#v", evmResp) + stateDBs = append(stateDBs, StateDBWithExplanation{ + StateDB: deps.App.EvmKeeper.Bank.StateDB, + Explanation: "DB after EthereumTx success", + ExpectEqual: false, + }) + + for _, err := range []error{ + testapp.FundAccount(deps.App.BankKeeper, deps.Ctx, deps.Sender.NibiruAddr, sendCoins), + testapp.FundFeeCollector(deps.App.BankKeeper, deps.Ctx, + math.NewIntFromUint64(gethparams.TxGas), + ), + } { + s.NoError(err) + } + evmResp, err = evmtest.TxTransferWei{ + Deps: &deps, + To: erc20Contract, + AmountWei: wei, + GasLimit: gethparams.TxGas * 2, + }.Run() + s.Require().NoErrorf(err, "%#v", evmResp) + s.Require().Contains(evmResp.VmError, "execution reverted") + } + + s.T().Log("Verify that the NibiruBankKeeper.StateDB is unaffected") + var first *statedb.StateDB + for idx, db := range stateDBs { + if idx == 0 { + first = db.StateDB + continue + } + if db.ExpectEqual { + s.True(first == db.StateDB, db.Explanation) + continue + } + s.False(first == db.StateDB, db.Explanation) + } +} diff --git a/x/evm/keeper/erc20.go b/x/evm/keeper/erc20.go index ed32a5788..ef8140f92 100644 --- a/x/evm/keeper/erc20.go +++ b/x/evm/keeper/erc20.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" + "math" "math/big" "cosmossdk.io/errors" @@ -26,6 +27,14 @@ const ( Erc20GasLimitExecute uint64 = 200_000 ) +// getCallGas returns the gas limit for a call to an ERC20 contract following 63/64 rule (EIP-150) +// protection against recursive calls ERC20 -> precompile -> ERC20. +func getCallGasWithLimit(ctx sdk.Context, gasLimit uint64) uint64 { + availableGas := ctx.GasMeter().GasRemaining() + callGas := availableGas - uint64(math.Floor(float64(availableGas)/64)) + return min(callGas, gasLimit) +} + // ERC20 returns a mutable reference to the keeper with an ERC20 contract ABI and // Go functions corresponding to contract calls in the ERC20 standard like "mint" // and "transfer" in the ERC20 standard. @@ -60,7 +69,7 @@ func (e erc20Calls) Mint( contract, from, to gethcommon.Address, amount *big.Int, ctx sdk.Context, ) (evmResp *evm.MsgEthereumTxResponse, err error) { - return e.CallContract(ctx, e.ABI, from, &contract, true, Erc20GasLimitExecute, "mint", to, amount) + return e.CallContract(ctx, e.ABI, from, &contract, true, getCallGasWithLimit(ctx, Erc20GasLimitExecute), "mint", to, amount) } /* @@ -82,7 +91,7 @@ func (e erc20Calls) Transfer( return balanceIncrease, nil, errors.Wrap(err, "failed to retrieve recipient balance") } - resp, err = e.CallContract(ctx, e.ABI, from, &contract, true, Erc20GasLimitExecute, "transfer", to, amount) + resp, err = e.CallContract(ctx, e.ABI, from, &contract, true, getCallGasWithLimit(ctx, Erc20GasLimitExecute), "transfer", to, amount) if err != nil { return balanceIncrease, nil, err } @@ -141,7 +150,7 @@ func (e erc20Calls) Burn( contract, from gethcommon.Address, amount *big.Int, ctx sdk.Context, ) (evmResp *evm.MsgEthereumTxResponse, err error) { - return e.CallContract(ctx, e.ABI, from, &contract, true, Erc20GasLimitExecute, "burn", amount) + return e.CallContract(ctx, e.ABI, from, &contract, true, getCallGasWithLimit(ctx, Erc20GasLimitExecute), "burn", amount) } func (k Keeper) LoadERC20Name( @@ -174,7 +183,7 @@ func (k Keeper) LoadERC20String( evm.EVM_MODULE_ADDRESS, &erc20Contract, false, - Erc20GasLimitQuery, + getCallGasWithLimit(ctx, Erc20GasLimitQuery), methodName, ) if err != nil { @@ -202,7 +211,7 @@ func (k Keeper) loadERC20Uint8( evm.EVM_MODULE_ADDRESS, &erc20Contract, false, - Erc20GasLimitQuery, + getCallGasWithLimit(ctx, Erc20GasLimitQuery), methodName, ) if err != nil { @@ -232,7 +241,7 @@ func (k Keeper) LoadERC20BigInt( evm.EVM_MODULE_ADDRESS, &contract, false, - Erc20GasLimitQuery, + getCallGasWithLimit(ctx, Erc20GasLimitQuery), methodName, args..., ) diff --git a/x/evm/keeper/funtoken_from_erc20_test.go b/x/evm/keeper/funtoken_from_erc20_test.go index 94c7b6960..f05fa2fd4 100644 --- a/x/evm/keeper/funtoken_from_erc20_test.go +++ b/x/evm/keeper/funtoken_from_erc20_test.go @@ -385,6 +385,73 @@ func (s *FunTokenFromErc20Suite) TestFunTokenFromERC20MaliciousTransfer() { s.Require().ErrorContains(err, "gas required exceeds allowance") } +// TestFunTokenInfiniteRecursionERC20 creates a funtoken from a contract +// with a malicious recursive balanceOf() and transfer() functions. +func (s *FunTokenFromErc20Suite) TestFunTokenInfiniteRecursionERC20() { + deps := evmtest.NewTestDeps() + + s.T().Log("Deploy InfiniteRecursionERC20") + metadata := keeper.ERC20Metadata{ + Name: "erc20name", + Symbol: "TOKEN", + Decimals: 18, + } + deployResp, err := evmtest.DeployContract( + &deps, embeds.SmartContract_TestInfiniteRecursionERC20, + metadata.Name, metadata.Symbol, metadata.Decimals, + ) + s.Require().NoError(err) + + erc20Addr := eth.EIP55Addr{ + Address: deployResp.ContractAddr, + } + + s.T().Log("happy: CreateFunToken for ERC20 with infinite recursion") + s.Require().NoError(testapp.FundAccount( + deps.App.BankKeeper, + deps.Ctx, + deps.Sender.NibiruAddr, + deps.EvmKeeper.FeeForCreateFunToken(deps.Ctx), + )) + + _, err = deps.EvmKeeper.CreateFunToken( + sdk.WrapSDKContext(deps.Ctx), + &evm.MsgCreateFunToken{ + FromErc20: &erc20Addr, + Sender: deps.Sender.NibiruAddr.String(), + }, + ) + s.Require().NoError(err) + + deps.ResetGasMeter() + + s.T().Log("happy: call attackBalance()") + res, err := deps.EvmKeeper.CallContract( + deps.Ctx, + embeds.SmartContract_TestInfiniteRecursionERC20.ABI, + deps.Sender.EthAddr, + &erc20Addr.Address, + false, + 10_000_000, + "attackBalance", + ) + s.Require().NoError(err) + s.Require().NotNil(res) + s.Require().Empty(res.VmError) + + s.T().Log("sad: call attackBalance()") + _, err = deps.EvmKeeper.CallContract( + deps.Ctx, + embeds.SmartContract_TestInfiniteRecursionERC20.ABI, + deps.Sender.EthAddr, + &erc20Addr.Address, + true, + 10_000_000, + "attackTransfer", + ) + s.Require().ErrorContains(err, "execution reverted") +} + type FunTokenFromErc20Suite struct { suite.Suite } diff --git a/x/evm/keeper/gas_fees.go b/x/evm/keeper/gas_fees.go index 4d17de0bd..58de7703d 100644 --- a/x/evm/keeper/gas_fees.go +++ b/x/evm/keeper/gas_fees.go @@ -140,13 +140,25 @@ func (k *Keeper) DeductTxCostsFromUserBalance( return nil } -// VerifyFee is used to return the fee for the given transaction data in -// sdk.Coins. It checks that the gas limit is not reached, the gas limit is -// higher than the intrinsic gas and that the base fee is lower than the gas fee -// cap. +// VerifyFee is used to return the fee, or token payment, for the given +// transaction data in [sdk.Coin]s. It checks that the the gas limit and uses the +// "effective fee" from the [evm.TxData]. +// +// - For [evm.DynamicFeeTx], the effective gas price is the minimum of +// (baseFee + tipCap) and the gas fee cap (feeCap). +// - For [evm.LegacyTx] and [evm.AccessListTx], the effective gas price is the +// max of the gas price and baseFee. +// +// Transactions where the baseFee exceeds the feeCap are priced out +// under EIP-1559 and will not pass validation. +// +// Args: +// - txData: Tx data related to gas, effectie gas, nonce, and chain ID +// implemented by every Ethereum tx type. +// - baseFeeMicronibi:EIP1559 base fee in units of micronibi ("unibi"). +// - isCheckTx: Comes from `[sdk.Context].isCheckTx()` func VerifyFee( txData evm.TxData, - denom string, baseFeeMicronibi *big.Int, isCheckTx bool, ) (sdk.Coins, error) { @@ -180,22 +192,13 @@ func VerifyFee( baseFeeMicronibi = evm.BASE_FEE_MICRONIBI } - // gasFeeCapMicronibi := evm.WeiToNative(txData.GetGasFeeCapWei()) - // if baseFeeMicronibi != nil && gasFeeCapMicronibi.Cmp(baseFeeMicronibi) < 0 { - // baseFeeWei := evm.NativeToWei(baseFeeMicronibi) - // return nil, errors.Wrapf(errortypes.ErrInsufficientFee, - // "the tx gasfeecap is lower than the tx baseFee: %s (gasfeecap), %s (basefee) wei per gas", - // txData.GetGasFeeCapWei(), - // baseFeeWei, - // ) - // } - baseFeeWei := evm.NativeToWei(baseFeeMicronibi) feeAmtMicronibi := evm.WeiToNative(txData.EffectiveFeeWei(baseFeeWei)) + bankDenom := evm.EVMBankDenom if feeAmtMicronibi.Sign() == 0 { // zero fee, no need to deduct - return sdk.Coins{{Denom: denom, Amount: sdkmath.ZeroInt()}}, nil + return sdk.Coins{{Denom: bankDenom, Amount: sdkmath.ZeroInt()}}, nil } - return sdk.Coins{{Denom: denom, Amount: sdkmath.NewIntFromBigInt(feeAmtMicronibi)}}, nil + return sdk.Coins{{Denom: bankDenom, Amount: sdkmath.NewIntFromBigInt(feeAmtMicronibi)}}, nil } diff --git a/x/evm/keeper/gas_fees_test.go b/x/evm/keeper/gas_fees_test.go index e9a1232fc..0ee23b00c 100644 --- a/x/evm/keeper/gas_fees_test.go +++ b/x/evm/keeper/gas_fees_test.go @@ -101,19 +101,18 @@ func (s *Suite) TestVerifyFee() { } }, } { - feeDenom := evm.EVMBankDenom isCheckTx := true tc := getTestCase() s.Run(tc.name, func() { gotCoins, err := evmkeeper.VerifyFee( - tc.txData, feeDenom, tc.baseFeeMicronibi, isCheckTx, + tc.txData, tc.baseFeeMicronibi, isCheckTx, ) if tc.wantErr != "" { s.Require().ErrorContains(err, tc.wantErr) return } s.Require().NoError(err) - s.Equal(tc.wantCoinAmt, gotCoins.AmountOf(feeDenom).String()) + s.Equal(tc.wantCoinAmt, gotCoins.AmountOf(evm.EVMBankDenom).String()) }) } } diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 31a887bbc..fd71412a1 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -65,12 +65,13 @@ func (k Keeper) EthAccount( ctx := sdk.UnwrapSDKContext(goCtx) acct := k.GetAccountOrEmpty(ctx, addrEth) + balNative := k.Bank.GetBalance(ctx, addrBech32, evm.EVMBankDenom).Amount.BigInt() return &evm.QueryEthAccountResponse{ EthAddress: addrEth.Hex(), Bech32Address: addrBech32.String(), - Balance: acct.BalanceNative.String(), - BalanceWei: evm.NativeToWei(acct.BalanceNative).String(), + Balance: balNative.String(), + BalanceWei: evm.NativeToWei(balNative).String(), CodeHash: gethcommon.BytesToHash(acct.CodeHash).Hex(), Nonce: acct.Nonce, }, nil @@ -650,7 +651,7 @@ const DefaultGethTraceTimeout = 5 * time.Second // Configures a Nibiru EVM tracer that is used to "trace" and analyze // the execution of transactions within a given block. Block information is read // from the context (goCtx). [TraceBlock] is responsible iterates over each Eth -// transacion message and calls [TraceEthTxMsg] on it. +// transaction message and calls [TraceEthTxMsg] on it. func (k Keeper) TraceBlock( goCtx context.Context, req *evm.QueryTraceBlockRequest, ) (*evm.QueryTraceBlockResponse, error) { diff --git a/x/evm/keeper/grpc_query_test.go b/x/evm/keeper/grpc_query_test.go index b1d8e0515..c0a807fb7 100644 --- a/x/evm/keeper/grpc_query_test.go +++ b/x/evm/keeper/grpc_query_test.go @@ -489,10 +489,9 @@ func (s *Suite) TestQueryEthCall() { wantErr: "InvalidArgument", }, { - name: "happy: eth call for erc20 token transfer", + name: "happy: eth call to deploy erc20 contract", scenario: func(deps *evmtest.TestDeps) (req In, wantResp Out) { fungibleTokenContract := embeds.SmartContract_ERC20Minter - jsonTxArgs, err := json.Marshal(&evm.JsonTxArgs{ From: &deps.Sender.EthAddr, Data: (*hexutil.Bytes)(&fungibleTokenContract.Bytecode), diff --git a/x/evm/keeper/msg_ethereum_tx_test.go b/x/evm/keeper/msg_ethereum_tx_test.go index 4d9f16345..c09122f89 100644 --- a/x/evm/keeper/msg_ethereum_tx_test.go +++ b/x/evm/keeper/msg_ethereum_tx_test.go @@ -18,6 +18,8 @@ import ( "github.com/NibiruChain/nibiru/v2/x/common/testutil/testapp" "github.com/NibiruChain/nibiru/v2/x/evm/embeds" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/NibiruChain/nibiru/v2/x/evm/evmtest" ) @@ -38,7 +40,7 @@ func (s *Suite) TestMsgEthereumTx_CreateContract() { deps.App.BankKeeper, deps.Ctx, authtypes.FeeCollectorName, - sdk.NewCoins(sdk.NewCoin("unibi", math.NewInt(1000_000))), + sdk.NewCoins(sdk.NewCoin("unibi", math.NewInt(1_000_000))), ) s.Require().NoError(err) s.T().Log("create eth tx msg, increase gas limit") @@ -233,3 +235,40 @@ func (s *Suite) TestMsgEthereumTx_SimpleTransfer() { ) } } + +func (s *Suite) TestEthereumTx_ABCI() { + deps := evmtest.NewTestDeps() + s.Require().NoError(testapp.FundAccount( + deps.App.BankKeeper, + deps.Ctx, + deps.Sender.NibiruAddr, + sdk.NewCoins(sdk.NewCoin(evm.EVMBankDenom, sdk.NewInt(69_420))), + )) + + blockHeader := deps.Ctx.BlockHeader() + // blockHeader := tmproto.Header{Height: deps.Ctx.BlockHeight()} + deps.App.BeginBlock(abci.RequestBeginBlock{Header: blockHeader}) + to := evmtest.NewEthPrivAcc() + evmTxMsg, err := evmtest.TxTransferWei{ + Deps: &deps, + To: to.EthAddr, + AmountWei: evm.NativeToWei(big.NewInt(420)), + }.Build() + s.NoError(err) + + txBuilder := deps.EncCfg.TxConfig.NewTxBuilder() + blockTx, err := evmTxMsg.BuildTx(txBuilder, evm.EVMBankDenom) + s.Require().NoError(err) + + txBz, err := deps.EncCfg.TxConfig.TxEncoder()(blockTx) + s.Require().NoError(err) + deliverTxResp := deps.App.DeliverTx(abci.RequestDeliverTx{Tx: txBz}) + s.Require().True(deliverTxResp.IsOK(), "%#v", deliverTxResp) + deps.App.EndBlock(abci.RequestEndBlock{Height: deps.Ctx.BlockHeight()}) + + { + r := deliverTxResp + s.EqualValuesf(21000, r.GasUsed, "%d", r.GasUsed) + s.EqualValuesf(21000, r.GasWanted, "%d", r.GasWanted) + } +} diff --git a/x/evm/keeper/msg_server.go b/x/evm/keeper/msg_server.go index b7a3ec9a8..1e946066f 100644 --- a/x/evm/keeper/msg_server.go +++ b/x/evm/keeper/msg_server.go @@ -59,25 +59,22 @@ func (k *Keeper) EthereumTx( return nil, errors.Wrap(err, "failed to return ethereum transaction as core message") } - tmpCtx, commitCtx := ctx.CacheContext() - - // pass true to commit the StateDB - evmResp, _, err = k.ApplyEvmMsg(tmpCtx, evmMsg, nil, true, evmConfig, txConfig, false) + // ApplyEvmMsg - Perform the EVM State transition + refundLeftoverGas := false + var tracer vm.EVMLogger = nil + evmResp, _, err = k.ApplyEvmMsg(ctx, evmMsg, tracer, true, evmConfig, txConfig, refundLeftoverGas) if err != nil { // when a transaction contains multiple msg, as long as one of the msg fails // all gas will be deducted. so is not msg.Gas() k.ResetGasMeterAndConsumeGas(ctx, ctx.GasMeter().Limit()) - return nil, errors.Wrap(err, "EthereumTx: failed to apply ethereum core message") + return nil, errors.Wrap(err, "error applying ethereum core message") } - if !evmResp.Failed() { - commitCtx() - } k.updateBlockBloom(ctx, evmResp, uint64(txConfig.LogIndex)) blockGasUsed, err := k.AddToBlockGasUsed(ctx, evmResp.GasUsed) if err != nil { - return nil, errors.Wrap(err, "EthereumTx: error adding transient gas used to block") + return nil, errors.Wrap(err, "error adding transient gas used to block") } // refund gas in order to match the Ethereum gas consumption instead of the @@ -88,7 +85,7 @@ func (k *Keeper) EthereumTx( } weiPerGas := txMsg.EffectiveGasPriceWeiPerGas(evmConfig.BaseFeeWei) if err = k.RefundGas(ctx, evmMsg.From(), refundGas, weiPerGas); err != nil { - return nil, errors.Wrapf(err, "EthereumTx: error refunding leftover gas to sender %s", evmMsg.From()) + return nil, errors.Wrapf(err, "error refunding leftover gas to sender %s", evmMsg.From()) } // reset the gas meter for current TxMsg (EthereumTx) @@ -96,15 +93,16 @@ func (k *Keeper) EthereumTx( err = k.EmitEthereumTxEvents(ctx, tx.To(), tx.Type(), evmMsg, evmResp) if err != nil { - return nil, errors.Wrap(err, "EthereumTx: error emitting ethereum tx events") + return nil, errors.Wrap(err, "error emitting ethereum tx events") } err = k.EmitLogEvents(ctx, evmResp) if err != nil { - return nil, errors.Wrap(err, "EthereumTx: error emitting tx logs") + return nil, errors.Wrap(err, "error emitting tx logs") } blockTxIdx := uint64(txConfig.TxIndex) + 1 k.EvmState.BlockTxIndex.Set(ctx, blockTxIdx) + return evmResp, nil } @@ -210,18 +208,18 @@ func (k Keeper) GetHashFn(ctx sdk.Context) vm.GetHashFunc { // will be returned to the client and the transaction won't be committed to the // store. // -// # Reverted state +// ## Reverted state // // The snapshot and rollback are supported by the `statedb.StateDB`. // -// # Different Callers +// ## Different Callers // // It's called in three scenarios: // 1. `ApplyTransaction`, in the transaction processing flow. // 2. `EthCall/EthEstimateGas` grpc query handler. // 3. Called by other native modules directly. // -// # Prechecks and Preprocessing +// ## Prechecks and Preprocessing // // All relevant state transition prechecks for the MsgEthereumTx are performed on the AnteHandler, // prior to running the transaction against the state. The prechecks run are the following: @@ -237,13 +235,17 @@ func (k Keeper) GetHashFn(ctx sdk.Context) vm.GetHashFunc { // // 1. set up the initial access list // -// # Tracer parameter -// It should be a `vm.Tracer` object or nil, if pass `nil`, it'll create a default one based on keeper options. +// ## Tracer parameter +// +// It should be a `vm.Tracer` object or nil, if pass `nil`, it'll create a +// default one based on keeper options. +// +// ## Commit parameter // -// # Commit parameter // If commit is true, the `StateDB` will be committed, otherwise discarded. // -// # fullRefundLeftoverGas parameter +// ## fullRefundLeftoverGas parameter +// // For internal calls like funtokens, user does not specify gas limit explicitly. // In this case we don't apply any caps for refund and refund 100% func (k *Keeper) ApplyEvmMsg(ctx sdk.Context, @@ -255,17 +257,28 @@ func (k *Keeper) ApplyEvmMsg(ctx sdk.Context, fullRefundLeftoverGas bool, ) (resp *evm.MsgEthereumTxResponse, evmObj *vm.EVM, err error) { var ( - ret []byte // return bytes from evm execution - vmErr error // vm errors do not effect consensus and are therefore not assigned to err + // return bytes from evm execution + ret []byte + // vm errors do not imply a failed query, thus they don't populate the + // function's "err" value. + vmErr error + ) + + var ( + stateDB *statedb.StateDB + // save a reference to return to the previous stateDB + oldStateDB *statedb.StateDB = k.Bank.StateDB ) - // save a reference to return to the previous stateDB - oldStateDb := k.Bank.StateDB defer func() { - k.Bank.StateDB = oldStateDb + if commit && err == nil && resp != nil { + k.Bank.StateDB = stateDB + } else { + k.Bank.StateDB = oldStateDB + } }() - stateDB := k.NewStateDB(ctx, txConfig) + stateDB = k.NewStateDB(ctx, txConfig) evmObj = k.NewEVM(ctx, msg, evmConfig, tracer, stateDB) leftoverGas := msg.Gas() diff --git a/x/evm/keeper/statedb_test.go b/x/evm/keeper/statedb_test.go index a9fd8cede..3ed34c838 100644 --- a/x/evm/keeper/statedb_test.go +++ b/x/evm/keeper/statedb_test.go @@ -45,7 +45,11 @@ func (s *Suite) TestStateDBBalance() { s.T().Log("Send via EVM transfer. See expected wei amounts.") to := gethcommon.HexToAddress("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") { - err := evmtest.TransferWei(&deps, to, evm.NativeToWei(big.NewInt(12))) + _, err := evmtest.TxTransferWei{ + Deps: &deps, + To: to, + AmountWei: evm.NativeToWei(big.NewInt(12)), + }.Run() s.Require().NoError(err) db := deps.NewStateDB() s.Equal( @@ -58,7 +62,11 @@ func (s *Suite) TestStateDBBalance() { ) s.T().Log("Send via EVM transfer with too little wei. Should error") - err = evmtest.TransferWei(&deps, to, big.NewInt(12)) + _, err = evmtest.TxTransferWei{ + Deps: &deps, + To: to, + AmountWei: big.NewInt(12), + }.Run() s.Require().ErrorContains(err, "wei amount is too small") } diff --git a/x/evm/precompile/funtoken.go b/x/evm/precompile/funtoken.go index 7aa22af09..272d96b18 100644 --- a/x/evm/precompile/funtoken.go +++ b/x/evm/precompile/funtoken.go @@ -60,6 +60,8 @@ func (p precompileFunToken) Run( // Gracefully handles "out of gas" defer HandleOutOfGasPanic(&err)() + abciEventsStartIdx := len(startResult.CacheCtx.EventManager().Events()) + method := startResult.Method switch PrecompileMethod(method.Name) { case FunTokenMethod_sendToBank: @@ -80,6 +82,17 @@ func (p precompileFunToken) Run( return nil, err } + // Emit extra events for the EVM if this is a transaction + // https://github.com/NibiruChain/nibiru/issues/2121 + if isMutation[PrecompileMethod(startResult.Method.Name)] { + EmitEventAbciEvents( + startResult.CacheCtx, + startResult.StateDB, + startResult.CacheCtx.EventManager().Events()[abciEventsStartIdx:], + p.Address(), + ) + } + // Gas consumed by a local gas meter contract.UseGas(startResult.CacheCtx.GasMeter().GasConsumed()) return bz, err @@ -118,6 +131,7 @@ func (p precompileFunToken) sendToBank( erc20, amount, to, err := p.parseArgsSendToBank(args) if err != nil { + err = ErrInvalidArgs(err) return } @@ -204,6 +218,7 @@ func (p precompileFunToken) sendToBank( } // TODO: UD-DEBUG: feat: Emit EVM events + // https://github.com/NibiruChain/nibiru/issues/2121 // TODO: emit event for balance change of sender // TODO: emit event for balance change of recipient @@ -376,6 +391,10 @@ func (p precompileFunToken) bankBalance( } addrEth, addrBech32, bankDenom, err := p.parseArgsBankBalance(args) + if err != nil { + err = ErrInvalidArgs(err) + return + } bankBal := p.evmKeeper.Bank.GetBalance(ctx, addrBech32, bankDenom).Amount.BigInt() return method.Outputs.Pack([]any{ @@ -455,7 +474,8 @@ func (p precompileFunToken) whoAmI( addrEth, addrBech32, err := p.parseArgsWhoAmI(args) if err != nil { - return bz, err + err = ErrInvalidArgs(err) + return } return method.Outputs.Pack([]any{ diff --git a/x/evm/precompile/funtoken_test.go b/x/evm/precompile/funtoken_test.go index 7645a26e5..0e03f2870 100644 --- a/x/evm/precompile/funtoken_test.go +++ b/x/evm/precompile/funtoken_test.go @@ -5,6 +5,7 @@ import ( "math/big" "testing" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/suite" @@ -21,6 +22,7 @@ import ( // TestSuite: Runs all the tests in the suite. func TestSuite(t *testing.T) { + suite.Run(t, new(UtilsSuite)) suite.Run(t, new(FuntokenSuite)) suite.Run(t, new(WasmSuite)) } @@ -223,6 +225,10 @@ func (s *FuntokenSuite) TestHappyPath() { s.NoError(err) deps.ResetGasMeter() + err = testapp.FundFeeCollector(deps.App.BankKeeper, deps.Ctx, + sdkmath.NewInt(70_000), + ) + s.NoError(err) _, ethTxResp, err := evmtest.CallContractTx( &deps, precompile.PrecompileAddr_FunToken, diff --git a/x/evm/precompile/nibiru_evm_utils.go b/x/evm/precompile/nibiru_evm_utils.go new file mode 100644 index 000000000..08805481f --- /dev/null +++ b/x/evm/precompile/nibiru_evm_utils.go @@ -0,0 +1,108 @@ +package precompile + +import ( + "bytes" + "fmt" + + abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" + gethcommon "github.com/ethereum/go-ethereum/common" + gethcore "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + + "github.com/NibiruChain/nibiru/v2/x/common/set" + "github.com/NibiruChain/nibiru/v2/x/evm/embeds" + "github.com/NibiruChain/nibiru/v2/x/evm/statedb" +) + +// EvmEventAbciEvent is the string key used to retrieve the "AbciEvent" Ethereum +// ABI event for a precompiled contract that implements the "INibiruEvm" +// interface from "Nibiru/x/evm/embeds/contracts/NibiruEvmUtils.sol". +const EvmEventAbciEvent = "AbciEvent" + +// EmitEventAbciEvents adds a sequence of ABCI events to the EVM state DB so that +// they can be emitted at the end of the "EthereumTx". These events are indexed +// by their ABCI event type and help communicate non-EVM events in Ethereum-based +// block explorers and indexers by saving the event attributes in JSON form. +// +// Instead of ABI packing the non-indexed argument, this function encodes the +// [gethcore.Log].Data as a JSON string directly to optimize readbility in +// explorers without requiring the reader to decode using an ABI. +// +// Simply use ["encoding/hex".DecodeString] with the "0x" prefix removed to read +// the ABCI event. +func EmitEventAbciEvents( + ctx sdk.Context, + db *statedb.StateDB, + abciEvents []sdk.Event, + emittingAddr gethcommon.Address, +) { + blockNumber := uint64(ctx.BlockHeight()) + event := embeds.SmartContract_Wasm.ABI.Events[EvmEventAbciEvent] + for _, abciEvent := range abciEvents { + // Why 2 topics? Because 2 = event ID + number of indexed event fields + topics := make([]gethcommon.Hash, 2) + topics[0] = event.ID + + // eventType is the first (and only) indexed field + topics[1] = EventTopicFromString(abciEvent.Type) + + attrsBz := AttrsToJSON(append([]abci.EventAttribute{ + {Key: "eventType", Value: abciEvent.Type}, + }, abciEvent.Attributes...)) + nonIndexedArgs, _ := event.Inputs.NonIndexed().Pack(string(attrsBz)) + db.AddLog(&gethcore.Log{ + Address: emittingAddr, + Topics: topics, + Data: nonIndexedArgs, + BlockNumber: blockNumber, + }) + } +} + +// AttrsToJSON creates a deterministic JSON encoding for the key-value tuples. +func AttrsToJSON(attrs []abci.EventAttribute) []byte { + if len(attrs) == 0 { + return []byte("") + } + keysSeen := set.New[string]() + + // Create JSON object from the key-value tuples + var buf bytes.Buffer + buf.WriteByte('{') + for i, attr := range attrs { + // Keys must be unique to guarantee valid JSON object + if keysSeen.Has(attr.Key) { + continue + } + keysSeen.Add(attr.Key) + + if i > 0 { + buf.WriteByte(',') + } + + // Quote key and value + _, _ = fmt.Fprintf(&buf, `"%s":"%s"`, attr.Key, attr.Value) + } + buf.WriteByte('}') + + return buf.Bytes() +} + +// EventTopicFromBytes creates a "Topic" hash for an EVM event log. +// An event topic is a 32-byte field used to index specific fields in a smart +// contract event. Topics make it possible to efficiently filter for and search +// events in transaction logs. +func EventTopicFromBytes(bz []byte) (topic gethcommon.Hash) { + hash := crypto.Keccak256Hash(bz) + copy(topic[:], hash[:]) + return topic +} + +// EventTopicFromString creates a "Topic" hash for an EVM event log. +// An event topic is a 32-byte field used to index specific fields in a smart +// contract event. Topics make it possible to efficiently filter for and search +// events in transaction logs. +func EventTopicFromString(str string) (topic gethcommon.Hash) { + return EventTopicFromBytes([]byte(str)) +} diff --git a/x/evm/precompile/nibiru_evm_utils_test.go b/x/evm/precompile/nibiru_evm_utils_test.go new file mode 100644 index 000000000..33348f281 --- /dev/null +++ b/x/evm/precompile/nibiru_evm_utils_test.go @@ -0,0 +1,169 @@ +package precompile_test + +import ( + "encoding/json" + "fmt" + + abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + abibind "github.com/ethereum/go-ethereum/accounts/abi/bind" + gethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + gethcore "github.com/ethereum/go-ethereum/core/types" + "github.com/stretchr/testify/suite" + + "github.com/NibiruChain/nibiru/v2/eth" + "github.com/NibiruChain/nibiru/v2/x/evm" + "github.com/NibiruChain/nibiru/v2/x/evm/embeds" + "github.com/NibiruChain/nibiru/v2/x/evm/evmtest" + "github.com/NibiruChain/nibiru/v2/x/evm/precompile" +) + +type UtilsSuite struct { + suite.Suite +} + +func (s *UtilsSuite) TestAttrsToJSON() { + testCases := []struct { + name string + attrs []abci.EventAttribute + want string + }{ + { + name: "repeated key - last value wins", + attrs: []abci.EventAttribute{ + {Key: "action", Value: "first"}, + {Key: "action", Value: "second"}, + {Key: "amount", Value: "100"}, + }, + want: `{"action":"first","amount":"100"}`, + }, + { + name: "three unique attributes", + attrs: []abci.EventAttribute{ + {Key: "sender", Value: "addr1"}, + {Key: "recipient", Value: "addr2"}, + {Key: "amount", Value: "150"}, + }, + want: `{"sender":"addr1","recipient":"addr2","amount":"150"}`, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + got := string(precompile.AttrsToJSON(tc.attrs)) + s.Equal(tc.want, got) + }) + } +} + +func (s *UtilsSuite) TestEmitEventAbciEvent() { + abiEventName := precompile.EvmEventAbciEvent + abi := embeds.SmartContract_FunToken.ABI + event, some := abi.Events[abiEventName] + s.True(some, abiEventName) + eventId := event.ID + + deps := evmtest.NewTestDeps() + db := deps.NewStateDB() + + s.T().Log("Mint coins to generate ABCI events") + startIdx := len(deps.Ctx.EventManager().Events()) + dbStartIdx := len(db.Logs()) + err := deps.App.BankKeeper.MintCoins(deps.Ctx, evm.ModuleName, + sdk.NewCoins(sdk.NewInt64Coin(evm.EVMBankDenom, 420_000)), + ) + s.NoError(err) + + abciEvents := deps.Ctx.EventManager().Events()[startIdx:] + s.Lenf(abciEvents, 2, "%+s", abciEvents) + + emittingAddr := precompile.PrecompileAddr_Wasm + precompile.EmitEventAbciEvents(deps.Ctx, db, abciEvents, emittingAddr) + blockNumber := uint64(deps.Ctx.BlockHeight()) + evmAddrBech32 := eth.EthAddrToNibiruAddr(evm.EVM_MODULE_ADDRESS) + type Want struct { + EventLog gethcore.Log + } + wants := []Want{ + { + EventLog: gethcore.Log{ + Address: emittingAddr, + Topics: []gethcommon.Hash{ + eventId, + precompile.EventTopicFromString(`coin_received`), + }, + Data: []byte(fmt.Sprintf( + `{"eventType":"coin_received","receiver":"%s","amount":"420000unibi"}`, evmAddrBech32), + ), + BlockNumber: blockNumber, + Index: uint(dbStartIdx), + }, + }, + { + EventLog: gethcore.Log{ + Address: emittingAddr, + Topics: []gethcommon.Hash{ + eventId, + precompile.EventTopicFromString(`coinbase`), + }, + Data: []byte(fmt.Sprintf( + `{"eventType":"coinbase","minter":"%s","amount":"420000unibi"}`, evmAddrBech32), + ), + BlockNumber: blockNumber, + Index: uint(dbStartIdx + 1), + }, + }, + } + + s.T().Log("Define the ABI and smart contract that will unpack the event data") + + boundContract := abibind.NewBoundContract( + emittingAddr, + *abi, + // verbose but descriptive to write out the interface implementations that are unused + (abibind.ContractCaller)(nil), + (abibind.ContractTransactor)(nil), + (abibind.ContractFilterer)(nil), + ) + + debugBz, _ := json.MarshalIndent(abciEvents, "", " ") + dbLogs := db.Logs() + for idx, want := range wants { + gotEventLog := *dbLogs[dbStartIdx+idx] + + s.T().Log("Check event log fields") + // logDataHex: Geth stores the bytes as a hex string (hexutil.Bytes) + logDataHex := hexutil.Bytes(gotEventLog.Data).String() + logDataHexDecoded, err := hexutil.Decode(logDataHex) + s.NoErrorf(err, "logDataHex: %s") + s.Contains(string(logDataHexDecoded), string(want.EventLog.Data)) + { + w, g := want.EventLog.Topics, gotEventLog.Topics + s.Require().EqualValuesf(w, g, "events:\n%#s", debugBz) + } + { + w, g := want.EventLog.Address.Hex(), gotEventLog.Address.Hex() + s.Require().EqualValuesf(w, g, "events:\n%#s", debugBz) + } + { + w, g := string(want.EventLog.Data), string(gotEventLog.Data) + s.Require().Containsf(g, w, "events:\n%#s", debugBz) + } + + s.T().Log("Use geth/.../abi/bind Go bindings to test ABI event decoding") + eventMap := make(map[string]any) + err = boundContract.UnpackLogIntoMap(eventMap, abiEventName, gotEventLog) + s.Require().NoError(err) + + abciEventValUntyped, isSome := eventMap["abciEvent"] + s.Truef(isSome, "%+s", eventMap) + abciEventVal, ok := abciEventValUntyped.(string) + s.True(ok, "%+s\nttype of abciEventVal: %T", eventMap, abciEventValUntyped) + s.Equal(string(want.EventLog.Data), string(abciEventVal), "%+s", eventMap) + + _, isSome = eventMap["eventType"] + s.Truef(isSome, "%+s", eventMap) + } +} diff --git a/x/evm/precompile/oracle.go b/x/evm/precompile/oracle.go index 17894da56..03c71352d 100644 --- a/x/evm/precompile/oracle.go +++ b/x/evm/precompile/oracle.go @@ -89,12 +89,16 @@ func (p precompileOracle) queryExchangeRate( return nil, err } - price, blockTime, blockHeight, err := p.oracleKeeper.GetDatedExchangeRate(ctx, assetPair) + priceAtBlock, err := p.oracleKeeper.ExchangeRates.Get(ctx, assetPair) if err != nil { return nil, err } - return method.Outputs.Pack(price.BigInt(), uint64(blockTime), blockHeight) + return method.Outputs.Pack( + priceAtBlock.ExchangeRate.BigInt(), + uint64(priceAtBlock.BlockTimestampMs), + priceAtBlock.CreatedBlock, + ) } func (p precompileOracle) parseQueryExchangeRateArgs(args []any) ( diff --git a/x/evm/precompile/oracle_test.go b/x/evm/precompile/oracle_test.go index 1051e12aa..6fad8af7f 100644 --- a/x/evm/precompile/oracle_test.go +++ b/x/evm/precompile/oracle_test.go @@ -1,6 +1,7 @@ package precompile_test import ( + "fmt" "math/big" "testing" "time" @@ -9,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/suite" + "github.com/NibiruChain/nibiru/v2/x/evm" "github.com/NibiruChain/nibiru/v2/x/evm/embeds" "github.com/NibiruChain/nibiru/v2/x/evm/evmtest" "github.com/NibiruChain/nibiru/v2/x/evm/precompile" @@ -56,14 +58,12 @@ func (s *OracleSuite) TestOracle_FailToPackABI() { func (s *OracleSuite) TestOracle_HappyPath() { deps := evmtest.NewTestDeps() - - s.T().Log("Query exchange rate") - { - deps.Ctx = deps.Ctx.WithBlockTime(time.Unix(69, 420)).WithBlockHeight(69) - deps.App.OracleKeeper.SetPrice(deps.Ctx, "unibi:uusd", sdk.MustNewDecFromStr("0.067")) - - resp, err := deps.EvmKeeper.CallContract( - deps.Ctx, + runQuery := func(ctx sdk.Context) ( + resp *evm.MsgEthereumTxResponse, + err error, + ) { + return deps.EvmKeeper.CallContract( + ctx, embeds.SmartContract_Oracle.ABI, deps.Sender.EthAddr, &precompile.PrecompileAddr_Oracle, @@ -72,16 +72,47 @@ func (s *OracleSuite) TestOracle_HappyPath() { "queryExchangeRate", "unibi:uusd", ) + } + + s.T().Log("Query exchange rate") + { + // 69 seconds + 420 nanoseconds === 69000 milliseconds for the + // return value from the UnixMilli() function + deps.Ctx = deps.Ctx.WithBlockTime(time.Unix(69, 420)).WithBlockHeight(69) + deps.App.OracleKeeper.SetPrice(deps.Ctx, "unibi:uusd", sdk.MustNewDecFromStr("0.067")) + + resp, err := runQuery(deps.Ctx) s.NoError(err) // Check the response - out, err := embeds.SmartContract_Oracle.ABI.Unpack(string(precompile.OracleMethod_queryExchangeRate), resp.Ret) + out, err := embeds.SmartContract_Oracle.ABI.Unpack( + string(precompile.OracleMethod_queryExchangeRate), resp.Ret, + ) + s.NoError(err) + s.Equal(out[0].(*big.Int), big.NewInt(67_000_000_000_000_000)) + s.Equal(fmt.Sprintf("%d", out[1].(uint64)), "69000") + s.Equal(fmt.Sprintf("%d", out[2].(uint64)), "69") + } + + s.T().Log("Query from a later time") + { + secondsLater := deps.Ctx.BlockTime().Add(100 * time.Second) + resp, err := runQuery(deps.Ctx. + WithBlockTime(secondsLater). + WithBlockHeight(deps.Ctx.BlockHeight() + 50), + ) s.NoError(err) // Check the response - s.Equal(out[0].(*big.Int), big.NewInt(67000000000000000)) - s.Equal(out[1].(uint64), uint64(69000)) - s.Equal(out[2].(uint64), uint64(69)) + out, err := embeds.SmartContract_Oracle.ABI.Unpack( + string(precompile.OracleMethod_queryExchangeRate), resp.Ret, + ) + s.NoError(err) + // These terms should still be equal because the latest exchange rate + // has not changed. + s.Equal(out[0].(*big.Int), big.NewInt(67_000_000_000_000_000)) + s.Equal(fmt.Sprintf("%d", out[1].(uint64)), "69000") + s.Equal(fmt.Sprintf("%d", out[2].(uint64)), "69") } } diff --git a/x/evm/precompile/wasm.go b/x/evm/precompile/wasm.go index dfc5d5042..7d1da8729 100644 --- a/x/evm/precompile/wasm.go +++ b/x/evm/precompile/wasm.go @@ -46,6 +46,8 @@ func (p precompileWasm) Run( // Gracefully handles "out of gas" defer HandleOutOfGasPanic(&err)() + abciEventsStartIdx := len(startResult.CacheCtx.EventManager().Events()) + // NOTE: The NibiruBankKeeper needs to reference the current [vm.StateDB] before // any operation that has the potential to use Bank send methods. This will // guarantee that [evmkeeper.Keeper.SetAccBalance] journal changes are @@ -72,6 +74,17 @@ func (p precompileWasm) Run( return nil, err } + // Emit extra events for the EVM if this is a transaction + // https://github.com/NibiruChain/nibiru/issues/2121 + if isMutation[PrecompileMethod(startResult.Method.Name)] { + EmitEventAbciEvents( + startResult.CacheCtx, + startResult.StateDB, + startResult.CacheCtx.EventManager().Events()[abciEventsStartIdx:], + p.Address(), + ) + } + // Gas consumed by a local gas meter // The reason it's unnecessary to check for a success value is because // GasConsumed is guaranteed to be less than the contract.Gas because the gas diff --git a/x/evm/statedb/journal_test.go b/x/evm/statedb/journal_test.go index 75fc9b6a0..e1260b819 100644 --- a/x/evm/statedb/journal_test.go +++ b/x/evm/statedb/journal_test.go @@ -107,7 +107,7 @@ func (s *Suite) TestComplexJournalChanges() { stateDB := evmObj.StateDB.(*statedb.StateDB) if stateDB.DebugDirtiesCount() != 2 { debugDirtiesCountMismatch(stateDB, s.T()) - s.FailNow("expected 2 dirty journal changes") + s.FailNowf("expected 2 dirty journal changes", "%#v", stateDB.Journal) } // The contract calling itself is invalid in this context. diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index 4c729ef34..1306dfc7f 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -121,7 +121,9 @@ func (s *StateDB) GetCacheContext() *sdk.Context { return &s.cacheCtx } -// AddLog adds a log, called by evm. +// AddLog adds to the EVM's event log for the current transaction. +// [AddLog] uses the [TxConfig] to populate the tx hash, block hash, tx index, +// and event log index. func (s *StateDB) AddLog(log *gethcore.Log) { s.Journal.append(addLogChange{}) @@ -132,7 +134,7 @@ func (s *StateDB) AddLog(log *gethcore.Log) { s.logs = append(s.logs, log) } -// Logs returns the logs of current transaction. +// Logs returns the event logs of current transaction. func (s *StateDB) Logs() []*gethcore.Log { return s.logs } diff --git a/x/evm/tx_data.go b/x/evm/tx_data.go index 5b1a75a78..c8bf3720c 100644 --- a/x/evm/tx_data.go +++ b/x/evm/tx_data.go @@ -32,6 +32,8 @@ var ( // provide custom implementations for these methods without creating a new TxData // data structure. Thus, the current interface exists. type TxData interface { + // TxType returns a byte (uint8) identifying the tx as a [LegacyTx] (0), + // [AccessListTx] (1), or [DynamicFeeTx] (2). TxType() byte Copy() TxData GetChainID() *big.Int @@ -86,14 +88,24 @@ type TxData interface { AsEthereumData() gethcore.TxData Validate() error - // static fee + // Fee in units of wei := gasPrice (wei per gas) * gasLimit (gas). Fee() *big.Int - // Cost is the gas cost of the transaction in wei + // Cost in units of wei := Fee * Value. Cost is the gas cost of the + // transaction in wei, accounting for value transferred. Cost() *big.Int - // effective gasPrice/fee/cost according to current base fee + // EffectiveGasPriceWeiPerGas is effective gas price in units of wei per gas. + // "Effective" means depending on the base fee of the network. EffectiveGasPriceWeiPerGas(baseFeeWei *big.Int) *big.Int + + // EffectiveFeeWei := effectiveGasPrice (wei per gas) * gasLimit (gas). + // "Effective" means depending on the base fee of the network. EffectiveFeeWei(baseFeeWei *big.Int) *big.Int + + // EffectiveCostWei is the same as cost, except it uses effective fee in wei + // rathen than fee. Effective cost is the gas cost of the transaction in wei, + // accounting for value (wei) transferred and using effective gas price (wei + // per gas). EffectiveCostWei(baseFeeWei *big.Int) *big.Int } diff --git a/x/evm/tx_data_access_list.go b/x/evm/tx_data_access_list.go index f55828421..acbcca26b 100644 --- a/x/evm/tx_data_access_list.go +++ b/x/evm/tx_data_access_list.go @@ -101,7 +101,8 @@ func newAccessListTx(tx *gethcore.Transaction) (*AccessListTx, error) { return txData, nil } -// TxType returns the tx type +// TxType returns a byte (uint8) identifying the tx as a [LegacyTx] (0), +// [AccessListTx] (1), or [DynamicFeeTx] (2). func (tx *AccessListTx) TxType() uint8 { return gethcore.AccessListTxType } @@ -280,12 +281,12 @@ func (tx AccessListTx) Validate() error { return nil } -// Fee returns gasprice * gaslimit. +// Fee returns gasPrice * gasLimit. func (tx AccessListTx) Fee() *big.Int { return priceTimesGas(tx.GetGasPrice(), tx.GetGas()) } -// Cost returns amount + gasprice * gaslimit. +// Cost returns amount + gasPrice * gasLimit. func (tx AccessListTx) Cost() *big.Int { return cost(tx.Fee(), tx.GetValueWei()) } diff --git a/x/evm/tx_data_dynamic_fee.go b/x/evm/tx_data_dynamic_fee.go index 694ed7bfb..040fa5d4d 100644 --- a/x/evm/tx_data_dynamic_fee.go +++ b/x/evm/tx_data_dynamic_fee.go @@ -75,7 +75,8 @@ func NewDynamicFeeTx(tx *gethcore.Transaction) (*DynamicFeeTx, error) { return txData, nil } -// TxType returns the tx type +// TxType returns a byte (uint8) identifying the tx as a [LegacyTx] (0), +// [AccessListTx] (1), or [DynamicFeeTx] (2). func (tx *DynamicFeeTx) TxType() uint8 { return gethcore.DynamicFeeTxType } @@ -285,12 +286,12 @@ func (tx DynamicFeeTx) Validate() error { return nil } -// Fee returns gasprice * gaslimit. +// Fee returns gasPrice * gasLimit. func (tx DynamicFeeTx) Fee() *big.Int { return priceTimesGas(tx.GetGasFeeCapWei(), tx.GasLimit) } -// Cost returns amount + gasprice * gaslimit. +// Cost returns amount + gasPrice * gasLimit. func (tx DynamicFeeTx) Cost() *big.Int { return cost(tx.Fee(), tx.GetValueWei()) } @@ -305,12 +306,12 @@ func (tx *DynamicFeeTx) EffectiveGasPriceWeiPerGas(baseFeeWei *big.Int) *big.Int return BigIntMax(baseFeeWei, rawEffectiveGasPrice) } -// EffectiveFeeWei returns effective_gasprice * gaslimit. +// EffectiveFeeWei returns effective_gasPrice * gasLimit. func (tx DynamicFeeTx) EffectiveFeeWei(baseFeeWei *big.Int) *big.Int { return priceTimesGas(tx.EffectiveGasPriceWeiPerGas(baseFeeWei), tx.GasLimit) } -// EffectiveCostWei returns amount + effective_gasprice * gaslimit. +// EffectiveCostWei returns amount + effective_gasPrice * gasLimit. func (tx DynamicFeeTx) EffectiveCostWei(baseFeeWei *big.Int) *big.Int { return cost(tx.EffectiveFeeWei(baseFeeWei), tx.GetValueWei()) } diff --git a/x/evm/tx_data_legacy.go b/x/evm/tx_data_legacy.go index 9f334ce97..1b3bab940 100644 --- a/x/evm/tx_data_legacy.go +++ b/x/evm/tx_data_legacy.go @@ -43,7 +43,8 @@ func NewLegacyTx(tx *gethcore.Transaction) (*LegacyTx, error) { return txData, nil } -// TxType returns the tx type +// TxType returns a byte (uint8) identifying the tx as a [LegacyTx] (0), +// [AccessListTx] (1), or [DynamicFeeTx] (2). func (tx *LegacyTx) TxType() uint8 { return gethcore.LegacyTxType } @@ -184,12 +185,13 @@ func (tx LegacyTx) Validate() error { return nil } -// Fee returns gasprice * gaslimit. +// Fee := gasPrice (wei per gas) * gasLimit (gas). Thus, fee is in units of +// wei. func (tx LegacyTx) Fee() *big.Int { return priceTimesGas(tx.GetGasPrice(), tx.GetGas()) } -// Cost returns amount + gasprice * gaslimit. +// Cost returns amount + gasPrice * gasLimit. func (tx LegacyTx) Cost() *big.Int { return cost(tx.Fee(), tx.GetValueWei()) } diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index f0e1c9dfb..13ccdbf7f 100644 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -17,7 +17,12 @@ func TestExportInitGenesis(t *testing.T) { input.OracleKeeper.Params.Set(input.Ctx, types.DefaultParams()) input.OracleKeeper.FeederDelegations.Insert(input.Ctx, keeper.ValAddrs[0], keeper.Addrs[1]) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, "pair1:pair2", types.DatedPrice{ExchangeRate: math.LegacyNewDec(123), CreatedBlock: 0}) + input.OracleKeeper.ExchangeRates.Insert(input.Ctx, "pair1:pair2", + types.ExchangeRateAtBlock{ + ExchangeRate: math.LegacyNewDec(123), + CreatedBlock: 0, + BlockTimestampMs: 0, + }) input.OracleKeeper.Prevotes.Insert(input.Ctx, keeper.ValAddrs[0], types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{123}, keeper.ValAddrs[0], uint64(2))) input.OracleKeeper.Votes.Insert(input.Ctx, keeper.ValAddrs[0], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Pair: "foo", ExchangeRate: math.LegacyNewDec(123)}}, keeper.ValAddrs[0])) input.OracleKeeper.WhitelistedPairs.Insert(input.Ctx, "pair1:pair1") diff --git a/x/oracle/keeper/querier.go b/x/oracle/keeper/grpc_query.go similarity index 89% rename from x/oracle/keeper/querier.go rename to x/oracle/keeper/grpc_query.go index 6cc7fbd2b..4410fdc7f 100644 --- a/x/oracle/keeper/querier.go +++ b/x/oracle/keeper/grpc_query.go @@ -50,12 +50,15 @@ func (q querier) ExchangeRate(c context.Context, req *types.QueryExchangeRateReq } ctx := sdk.UnwrapSDKContext(c) - exchangeRate, err := q.Keeper.GetExchangeRate(ctx, req.Pair) + out, err := q.Keeper.ExchangeRates.Get(ctx, req.Pair) if err != nil { return nil, err } - - return &types.QueryExchangeRateResponse{ExchangeRate: exchangeRate}, nil + return &types.QueryExchangeRateResponse{ + ExchangeRate: out.ExchangeRate, + BlockTimestampMs: out.BlockTimestampMs, + BlockHeight: out.CreatedBlock, + }, nil } /* @@ -79,24 +82,6 @@ func (q querier) ExchangeRateTwap(c context.Context, req *types.QueryExchangeRat return &types.QueryExchangeRateResponse{ExchangeRate: twap}, nil } -// get the latest price snapshot from the oracle for a pair -func (q querier) DatedExchangeRate(c context.Context, req *types.QueryExchangeRateRequest) (response *types.QueryDatedExchangeRateResponse, err error) { - if _, err = q.ExchangeRate(c, req); err != nil { - return - } - - ctx := sdk.UnwrapSDKContext(c) - price, blockTime, blockHeight, err := q.Keeper.GetDatedExchangeRate(ctx, req.Pair) - if err != nil { - return &types.QueryDatedExchangeRateResponse{}, err - } - return &types.QueryDatedExchangeRateResponse{ - Price: price, - BlockTimestampMs: blockTime, - BlockHeight: blockHeight, - }, nil -} - // ExchangeRates queries exchange rates of all pairs func (q querier) ExchangeRates(c context.Context, _ *types.QueryExchangeRatesRequest) (*types.QueryExchangeRatesResponse, error) { ctx := sdk.UnwrapSDKContext(c) diff --git a/x/oracle/keeper/querier_test.go b/x/oracle/keeper/grpc_query_test.go similarity index 82% rename from x/oracle/keeper/querier_test.go rename to x/oracle/keeper/grpc_query_test.go index 45e39ccdc..c6ff2f4ad 100644 --- a/x/oracle/keeper/querier_test.go +++ b/x/oracle/keeper/grpc_query_test.go @@ -10,6 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/NibiruChain/nibiru/v2/x/common/set" testutilevents "github.com/NibiruChain/nibiru/v2/x/common/testutil" "github.com/NibiruChain/nibiru/v2/x/common/asset" @@ -37,7 +38,15 @@ func TestQueryExchangeRate(t *testing.T) { querier := NewQuerier(input.OracleKeeper) rate := math.LegacyNewDec(1700) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) + input.OracleKeeper.ExchangeRates.Insert( + input.Ctx, + asset.Registry.Pair(denoms.ETH, denoms.NUSD), + types.ExchangeRateAtBlock{ + ExchangeRate: rate, + CreatedBlock: uint64(input.Ctx.BlockHeight()), + BlockTimestampMs: input.Ctx.BlockTime().UnixMilli(), + }, + ) // empty request _, err := querier.ExchangeRate(ctx, nil) @@ -77,8 +86,24 @@ func TestQueryExchangeRates(t *testing.T) { querier := NewQuerier(input.OracleKeeper) rate := math.LegacyNewDec(1700) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) + input.OracleKeeper.ExchangeRates.Insert( + input.Ctx, + asset.Registry.Pair(denoms.BTC, denoms.NUSD), + types.ExchangeRateAtBlock{ + ExchangeRate: rate, + CreatedBlock: uint64(input.Ctx.BlockHeight()), + BlockTimestampMs: input.Ctx.BlockTime().UnixMilli(), + }, + ) + input.OracleKeeper.ExchangeRates.Insert( + input.Ctx, + asset.Registry.Pair(denoms.ETH, denoms.NUSD), + types.ExchangeRateAtBlock{ + ExchangeRate: rate, + CreatedBlock: uint64(input.Ctx.BlockHeight()), + BlockTimestampMs: input.Ctx.BlockTime().UnixMilli(), + }, + ) res, err := querier.ExchangeRates(ctx, &types.QueryExchangeRatesRequest{}) require.NoError(t, err) @@ -122,9 +147,12 @@ func TestQueryDatedExchangeRate(t *testing.T) { input := CreateTestFixture(t) querier := NewQuerier(input.OracleKeeper) - // Set initial block time and height initialTime := input.Ctx.BlockTime() initialHeight := input.Ctx.BlockHeight() + t.Logf("Set initial block time and height\ninitialTimeSeconds: %d, intialHeight: %d", + initialTime.Unix(), + initialHeight, + ) // Pair 1: BTC/NUSD pairBTC := asset.Registry.Pair(denoms.BTC, denoms.NUSD) @@ -148,11 +176,17 @@ func TestQueryDatedExchangeRate(t *testing.T) { }, ) - // Advance time and block height - input.Ctx = input.Ctx.WithBlockTime(initialTime.Add(1 * time.Second)). - WithBlockHeight(initialHeight + 1) + blockTime := initialTime.Add(1 * time.Second) + blockHeight := initialHeight + 1 + t.Logf("Advance time and block height\nblockTimeSeconds: %d, blockHeight: %d", + blockTime.Unix(), + blockHeight, + ) + input.Ctx = input.Ctx. + WithBlockTime(blockTime). + WithBlockHeight(blockHeight) - // --- Set first price for ETH/NUSD --- + t.Log("Set first price for ETH") input.OracleKeeper.SetPrice(input.Ctx, pairETH, rateETH1) testutilevents.RequireContainsTypedEvent( t, @@ -164,11 +198,17 @@ func TestQueryDatedExchangeRate(t *testing.T) { }, ) - // Advance time and block height - input.Ctx = input.Ctx.WithBlockTime(initialTime.Add(2 * time.Second)). - WithBlockHeight(initialHeight + 2) + blockTime = initialTime.Add(2 * time.Second) + blockHeight = initialHeight + 2 + t.Logf("Advance time and block height\nblockTimeSeconds: %d, blockHeight: %d", + blockTime.Unix(), + blockHeight, + ) + input.Ctx = input.Ctx. + WithBlockTime(blockTime). + WithBlockHeight(blockHeight) - // --- Set second price for BTC/NUSD --- + t.Log("Set second price for BTC") input.OracleKeeper.SetPrice(input.Ctx, pairBTC, rateBTC2) testutilevents.RequireContainsTypedEvent( t, @@ -180,11 +220,12 @@ func TestQueryDatedExchangeRate(t *testing.T) { }, ) - // Advance time and block height - input.Ctx = input.Ctx.WithBlockTime(initialTime.Add(3 * time.Second)). + t.Log("Advance time and block height") + input.Ctx = input.Ctx. + WithBlockTime(initialTime.Add(3 * time.Second)). WithBlockHeight(initialHeight + 3) - // --- Set second price for ETH/NUSD --- + t.Log("Set second price for ETH") input.OracleKeeper.SetPrice(input.Ctx, pairETH, rateETH2) testutilevents.RequireContainsTypedEvent( t, @@ -199,28 +240,33 @@ func TestQueryDatedExchangeRate(t *testing.T) { // Wrap context for querying ctx := sdk.WrapSDKContext(input.Ctx) - // --- Query latest snapshot for BTC/NUSD --- - resBTC, err := querier.DatedExchangeRate( + t.Log("Query latest snapshot for BTC") + resBTC, err := querier.ExchangeRate( ctx, &types.QueryExchangeRateRequest{Pair: pairBTC}, ) require.NoError(t, err) - require.Equal(t, rateBTC2, resBTC.Price) - require.Equal(t, input.Ctx.BlockTime().UnixMilli(), resBTC.BlockTimestampMs) + res := resBTC + require.Equal(t, rateBTC2.String(), resBTC.ExchangeRate.String()) + require.Equal(t, initialTime.Add(2*time.Second).UnixMilli(), res.BlockTimestampMs) + require.Equal(t, uint64(initialHeight+2), res.BlockHeight) - // --- Query latest snapshot for ETH/NUSD --- - resETH, err := querier.DatedExchangeRate( + t.Log("Query latest snapshot for ETH") + resETH, err := querier.ExchangeRate( ctx, &types.QueryExchangeRateRequest{Pair: pairETH}, ) require.NoError(t, err) - require.Equal(t, rateETH2, resETH.Price) - require.Equal(t, input.Ctx.BlockTime().UnixMilli(), resETH.BlockTimestampMs) - - // --- Query a pair with no snapshots (should return an error) --- - pairATOM := asset.Registry.Pair(denoms.ATOM, denoms.NUSD) - _, err = querier.DatedExchangeRate(ctx, &types.QueryExchangeRateRequest{Pair: pairATOM}) - require.Error(t, err) + res = resETH + require.Equal(t, rateETH2, res.ExchangeRate) + require.Equal(t, initialTime.Add(3*time.Second).UnixMilli(), res.BlockTimestampMs) + require.Equal(t, uint64(initialHeight+3), res.BlockHeight) + + t.Run("Query a pair with no snapshots (should return an error)", func(t *testing.T) { + pairATOM := asset.Registry.Pair(denoms.ATOM, denoms.NUSD) + _, err = querier.ExchangeRate(ctx, &types.QueryExchangeRateRequest{Pair: pairATOM}) + require.Error(t, err) + }) } func TestCalcTwap(t *testing.T) { @@ -312,20 +358,26 @@ func TestQueryActives(t *testing.T) { queryClient := NewQuerier(input.OracleKeeper) rate := math.LegacyNewDec(1700) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.NIBI, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) + targetPairs := set.New[asset.Pair]() + for _, bankDenom := range []string{denoms.BTC, denoms.ETH, denoms.NIBI} { + pair := asset.Registry.Pair(bankDenom, denoms.NUSD) + targetPairs.Add(pair) + input.OracleKeeper.ExchangeRates.Insert( + input.Ctx, + pair, + types.ExchangeRateAtBlock{ + ExchangeRate: rate, + CreatedBlock: uint64(input.Ctx.BlockHeight()), + BlockTimestampMs: input.Ctx.BlockTime().UnixMilli(), + }, + ) + } res, err := queryClient.Actives(ctx, &types.QueryActivesRequest{}) require.NoError(t, err) - - targetPairs := []asset.Pair{ - asset.Registry.Pair(denoms.BTC, denoms.NUSD), - asset.Registry.Pair(denoms.ETH, denoms.NUSD), - asset.Registry.Pair(denoms.NIBI, denoms.NUSD), + for _, pair := range res.Actives { + require.True(t, targetPairs.Has(pair)) } - - require.Equal(t, targetPairs, res.Actives) } func TestQueryFeederDelegation(t *testing.T) { diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index bbbf31ce9..e7beb8026 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -35,7 +35,7 @@ type Keeper struct { // Module parameters Params collections.Item[types.Params] - ExchangeRates collections.Map[asset.Pair, types.DatedPrice] + ExchangeRates collections.Map[asset.Pair, types.ExchangeRateAtBlock] FeederDelegations collections.Map[sdk.ValAddress, sdk.AccAddress] MissCounters collections.Map[sdk.ValAddress, uint64] Prevotes collections.Map[sdk.ValAddress, types.AggregateExchangeRatePrevote] @@ -80,7 +80,7 @@ func NewKeeper( sudoKeeper: sudoKeeper, distrModuleName: distrName, Params: collections.NewItem(storeKey, 11, collections.ProtoValueEncoder[types.Params](cdc)), - ExchangeRates: collections.NewMap(storeKey, 1, asset.PairKeyEncoder, collections.ProtoValueEncoder[types.DatedPrice](cdc)), + ExchangeRates: collections.NewMap(storeKey, 1, asset.PairKeyEncoder, collections.ProtoValueEncoder[types.ExchangeRateAtBlock](cdc)), PriceSnapshots: collections.NewMap(storeKey, 10, collections.PairKeyEncoder(asset.PairKeyEncoder, collections.TimeKeyEncoder), collections.ProtoValueEncoder[types.PriceSnapshot](cdc)), FeederDelegations: collections.NewMap(storeKey, 2, collections.ValAddressKeyEncoder, collections.AccAddressValueEncoder), MissCounters: collections.NewMap(storeKey, 3, collections.ValAddressKeyEncoder, collections.Uint64ValueEncoder), @@ -168,7 +168,8 @@ func (k Keeper) GetExchangeRateTwap(ctx sdk.Context, pair asset.Pair) (price sdk for i, s := range snapshots { var nextTimestampMs int64 if i == len(snapshots)-1 { - // if we're at the last snapshot, then consider that price as ongoing until the current blocktime + // if we're at the last snapshot, then consider that price as ongoing + // until the current blocktime nextTimestampMs = ctx.BlockTime().UnixMilli() } else { nextTimestampMs = snapshots[i+1].TimestampMs @@ -181,37 +182,26 @@ func (k Keeper) GetExchangeRateTwap(ctx sdk.Context, pair asset.Pair) (price sdk return cumulativePrice.QuoInt64(ctx.BlockTime().UnixMilli() - firstTimestampMs), nil } -func (k Keeper) GetExchangeRate(ctx sdk.Context, pair asset.Pair) (price sdk.Dec, err error) { - exchangeRate, err := k.ExchangeRates.Get(ctx, pair) - price = exchangeRate.ExchangeRate - return -} - -func (k Keeper) GetDatedExchangeRate(ctx sdk.Context, pair asset.Pair) (price sdk.Dec, blockTimeMs int64, BlockHeight uint64, err error) { - exchangeRate, err := k.ExchangeRates.Get(ctx, pair) - if err != nil { - return - } - time := ctx.WithBlockHeight(int64(exchangeRate.CreatedBlock)).BlockTime() - - return exchangeRate.ExchangeRate, time.UnixMilli(), exchangeRate.CreatedBlock, nil -} - // SetPrice sets the price for a pair as well as the price snapshot. func (k Keeper) SetPrice(ctx sdk.Context, pair asset.Pair, price sdk.Dec) { - k.ExchangeRates.Insert(ctx, pair, types.DatedPrice{ExchangeRate: price, CreatedBlock: uint64(ctx.BlockHeight())}) + blockTimestampMs := ctx.BlockTime().UnixMilli() + k.ExchangeRates.Insert(ctx, pair, + types.ExchangeRateAtBlock{ + ExchangeRate: price, + CreatedBlock: uint64(ctx.BlockHeight()), + BlockTimestampMs: blockTimestampMs, + }) key := collections.Join(pair, ctx.BlockTime()) - timestampMs := ctx.BlockTime().UnixMilli() k.PriceSnapshots.Insert(ctx, key, types.PriceSnapshot{ Pair: pair, Price: price, - TimestampMs: timestampMs, + TimestampMs: blockTimestampMs, }) if err := ctx.EventManager().EmitTypedEvent(&types.EventPriceUpdate{ Pair: pair.String(), Price: price, - TimestampMs: timestampMs, + TimestampMs: blockTimestampMs, }); err != nil { ctx.Logger().Error("failed to emit OraclePriceUpdate", "pair", pair, "error", err) } diff --git a/x/oracle/keeper/test_utils.go b/x/oracle/keeper/test_utils.go index 3944bb962..50b65e8ba 100644 --- a/x/oracle/keeper/test_utils.go +++ b/x/oracle/keeper/test_utils.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "cosmossdk.io/math" + sdkmath "cosmossdk.io/math" "github.com/NibiruChain/nibiru/v2/x/common/denoms" "github.com/NibiruChain/nibiru/v2/x/oracle/types" "github.com/NibiruChain/nibiru/v2/x/sudo" @@ -222,9 +222,7 @@ func CreateTestFixture(t *testing.T) TestFixture { distrKeeper.SetFeePool(ctx, distrtypes.InitialFeePool()) distrParams := distrtypes.DefaultParams() - distrParams.CommunityTax = math.LegacyNewDecWithPrec(2, 2) - distrParams.BaseProposerReward = math.LegacyNewDecWithPrec(1, 2) - distrParams.BonusProposerReward = math.LegacyNewDecWithPrec(4, 2) + distrParams.CommunityTax = sdkmath.LegacyNewDecWithPrec(2, 2) distrKeeper.SetParams(ctx, distrParams) stakingKeeper.SetHooks(stakingtypes.NewMultiStakingHooks(distrKeeper.Hooks())) @@ -283,12 +281,12 @@ func CreateTestFixture(t *testing.T) TestFixture { // NewTestMsgCreateValidator test msg creator func NewTestMsgCreateValidator( - address sdk.ValAddress, pubKey cryptotypes.PubKey, amt sdk.Int, + address sdk.ValAddress, pubKey cryptotypes.PubKey, amt sdkmath.Int, ) *stakingtypes.MsgCreateValidator { - commission := stakingtypes.NewCommissionRates(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()) + commission := stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()) msg, _ := stakingtypes.NewMsgCreateValidator( address, pubKey, sdk.NewCoin(denoms.NIBI, amt), - stakingtypes.Description{}, commission, math.OneInt(), + stakingtypes.Description{}, commission, sdkmath.OneInt(), ) return msg @@ -312,7 +310,7 @@ func AllocateRewards(t *testing.T, input TestFixture, rewards sdk.Coins, votePer var ( testStakingAmt = sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction) - testExchangeRate = math.LegacyNewDec(1700) + testExchangeRate = sdkmath.LegacyNewDec(1700) ) func Setup(t *testing.T) (TestFixture, types.MsgServer) { diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index 3ada32d99..2585900fd 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -260,23 +260,27 @@ func (m *ExchangeRateTuple) XXX_DiscardUnknown() { var xxx_messageInfo_ExchangeRateTuple proto.InternalMessageInfo -type DatedPrice struct { +type ExchangeRateAtBlock struct { ExchangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"exchange_rate" yaml:"exchange_rate"` CreatedBlock uint64 `protobuf:"varint,2,opt,name=created_block,json=createdBlock,proto3" json:"created_block,omitempty" yaml:"created_block"` + // Block timestamp for the block where the oracle came to consensus for this + // price. This timestamp is a conventional Unix millisecond time, i.e. the + // number of milliseconds elapsed since January 1, 1970 UTC. + BlockTimestampMs int64 `protobuf:"varint,3,opt,name=block_timestamp_ms,json=blockTimestampMs,proto3" json:"block_timestamp_ms,omitempty" yaml:"block_timestamp_ms"` } -func (m *DatedPrice) Reset() { *m = DatedPrice{} } -func (m *DatedPrice) String() string { return proto.CompactTextString(m) } -func (*DatedPrice) ProtoMessage() {} -func (*DatedPrice) Descriptor() ([]byte, []int) { +func (m *ExchangeRateAtBlock) Reset() { *m = ExchangeRateAtBlock{} } +func (m *ExchangeRateAtBlock) String() string { return proto.CompactTextString(m) } +func (*ExchangeRateAtBlock) ProtoMessage() {} +func (*ExchangeRateAtBlock) Descriptor() ([]byte, []int) { return fileDescriptor_43d45df86ea09ed4, []int{4} } -func (m *DatedPrice) XXX_Unmarshal(b []byte) error { +func (m *ExchangeRateAtBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *DatedPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ExchangeRateAtBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_DatedPrice.Marshal(b, m, deterministic) + return xxx_messageInfo_ExchangeRateAtBlock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -286,25 +290,32 @@ func (m *DatedPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *DatedPrice) XXX_Merge(src proto.Message) { - xxx_messageInfo_DatedPrice.Merge(m, src) +func (m *ExchangeRateAtBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExchangeRateAtBlock.Merge(m, src) } -func (m *DatedPrice) XXX_Size() int { +func (m *ExchangeRateAtBlock) XXX_Size() int { return m.Size() } -func (m *DatedPrice) XXX_DiscardUnknown() { - xxx_messageInfo_DatedPrice.DiscardUnknown(m) +func (m *ExchangeRateAtBlock) XXX_DiscardUnknown() { + xxx_messageInfo_ExchangeRateAtBlock.DiscardUnknown(m) } -var xxx_messageInfo_DatedPrice proto.InternalMessageInfo +var xxx_messageInfo_ExchangeRateAtBlock proto.InternalMessageInfo -func (m *DatedPrice) GetCreatedBlock() uint64 { +func (m *ExchangeRateAtBlock) GetCreatedBlock() uint64 { if m != nil { return m.CreatedBlock } return 0 } +func (m *ExchangeRateAtBlock) GetBlockTimestampMs() int64 { + if m != nil { + return m.BlockTimestampMs + } + return 0 +} + // Rewards defines a credit object towards validators // which provide prices faithfully for different pairs. type Rewards struct { @@ -376,75 +387,77 @@ func init() { proto.RegisterType((*AggregateExchangeRatePrevote)(nil), "nibiru.oracle.v1.AggregateExchangeRatePrevote") proto.RegisterType((*AggregateExchangeRateVote)(nil), "nibiru.oracle.v1.AggregateExchangeRateVote") proto.RegisterType((*ExchangeRateTuple)(nil), "nibiru.oracle.v1.ExchangeRateTuple") - proto.RegisterType((*DatedPrice)(nil), "nibiru.oracle.v1.DatedPrice") + proto.RegisterType((*ExchangeRateAtBlock)(nil), "nibiru.oracle.v1.ExchangeRateAtBlock") proto.RegisterType((*Rewards)(nil), "nibiru.oracle.v1.Rewards") } func init() { proto.RegisterFile("nibiru/oracle/v1/oracle.proto", fileDescriptor_43d45df86ea09ed4) } var fileDescriptor_43d45df86ea09ed4 = []byte{ - // 977 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0x26, 0x4e, 0x1a, 0x8f, 0x93, 0x92, 0x4c, 0x53, 0xd8, 0x84, 0xe2, 0x0d, 0x53, 0xa9, - 0xca, 0x01, 0x76, 0x95, 0x50, 0x84, 0x88, 0xc4, 0x81, 0x6d, 0x08, 0x8a, 0x08, 0xc8, 0x1a, 0x55, - 0x20, 0x71, 0x59, 0xcd, 0xee, 0x4e, 0xec, 0x21, 0xbb, 0x3b, 0xd6, 0xcc, 0xda, 0x4e, 0x24, 0xc4, - 0x99, 0x63, 0x4f, 0x88, 0x63, 0xce, 0xdc, 0xb8, 0xf1, 0x27, 0xf4, 0x84, 0x7a, 0x44, 0x3d, 0x6c, - 0xab, 0xe4, 0x52, 0xc1, 0xcd, 0x7f, 0x01, 0x9a, 0xd9, 0x71, 0xbc, 0xc1, 0x3e, 0x34, 0x20, 0x4e, - 0xde, 0xf7, 0xbe, 0x99, 0xef, 0x7d, 0xef, 0xc7, 0xcc, 0x18, 0xbc, 0x93, 0xb1, 0x90, 0x89, 0xbe, - 0xc7, 0x05, 0x89, 0x12, 0xea, 0x0d, 0x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15, 0xdc, - 0xcc, 0xe4, 0x9c, 0x9e, 0x49, 0x7b, 0xb2, 0xfd, 0x1a, 0x8c, 0xf0, 0xb2, 0xb1, 0xf5, 0x54, 0x22, - 0x09, 0x6e, 0x61, 0xfd, 0x06, 0x49, 0x78, 0x1b, 0xcc, 0x31, 0xf3, 0x0e, 0xe3, 0x39, 0x16, 0xc3, - 0x77, 0xc1, 0x72, 0xe5, 0x0d, 0x96, 0x25, 0x31, 0x6e, 0x4e, 0x5e, 0x62, 0x09, 0x3f, 0x04, 0x0b, - 0xea, 0x71, 0x97, 0xf6, 0xbc, 0x9e, 0xcd, 0x0d, 0xb7, 0x4c, 0xc4, 0x55, 0xcf, 0xbf, 0x6b, 0x9e, - 0x7f, 0xf7, 0x11, 0x67, 0x99, 0x5f, 0x57, 0xc9, 0xe3, 0x72, 0xb5, 0x7f, 0xf8, 0xf4, 0xa2, 0x65, - 0x3d, 0xbb, 0x68, 0x59, 0x2f, 0x2f, 0x5a, 0xd6, 0x93, 0xcb, 0x56, 0xed, 0xd9, 0x65, 0xab, 0xf6, - 0xc7, 0x65, 0xab, 0xf6, 0xad, 0xf7, 0x1a, 0xb3, 0x60, 0xfe, 0xc2, 0xe8, 0x42, 0x85, 0x8b, 0xfa, - 0xda, 0xfd, 0xe0, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x89, 0xe7, 0x1a, 0xe9, 0xe0, 0x08, 0x00, + // 1009 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0x26, 0x4e, 0x1a, 0x8f, 0x93, 0x92, 0x4c, 0x52, 0xd8, 0x84, 0xd6, 0x1b, 0xa6, 0x52, + 0x95, 0x03, 0xec, 0x2a, 0xa1, 0x08, 0x11, 0x89, 0x43, 0xb7, 0x21, 0x28, 0x6a, 0x8a, 0xa2, 0x51, + 0x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 0xb8, 0xf7, 0xfc, 0xa2, + 0xe1, 0xbc, 0xb8, 0x68, 0x38, 0xaf, 0x2f, 0x1a, 0xce, 0xb3, 0xcb, 0x46, 0xe5, 0xc5, 0x65, 0xa3, + 0xf2, 0xc7, 0x65, 0xa3, 0xf2, 0x6d, 0xf0, 0x16, 0x1d, 0x66, 0x1f, 0x46, 0x3a, 0xeb, 0xcd, 0x59, + 0x3d, 0xcc, 0x3f, 0xfe, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xa2, 0x1f, 0x50, 0xdb, 0x36, 0x09, 0x00, 0x00, } @@ -751,7 +764,7 @@ func (m *ExchangeRateTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *DatedPrice) Marshal() (dAtA []byte, err error) { +func (m *ExchangeRateAtBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -761,16 +774,21 @@ func (m *DatedPrice) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *DatedPrice) MarshalTo(dAtA []byte) (int, error) { +func (m *ExchangeRateAtBlock) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *DatedPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ExchangeRateAtBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if m.BlockTimestampMs != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.BlockTimestampMs)) + i-- + dAtA[i] = 0x18 + } if m.CreatedBlock != 0 { i = encodeVarintOracle(dAtA, i, uint64(m.CreatedBlock)) i-- @@ -938,7 +956,7 @@ func (m *ExchangeRateTuple) Size() (n int) { return n } -func (m *DatedPrice) Size() (n int) { +func (m *ExchangeRateAtBlock) Size() (n int) { if m == nil { return 0 } @@ -949,6 +967,9 @@ func (m *DatedPrice) Size() (n int) { if m.CreatedBlock != 0 { n += 1 + sovOracle(uint64(m.CreatedBlock)) } + if m.BlockTimestampMs != 0 { + n += 1 + sovOracle(uint64(m.BlockTimestampMs)) + } return n } @@ -1711,7 +1732,7 @@ func (m *ExchangeRateTuple) Unmarshal(dAtA []byte) error { } return nil } -func (m *DatedPrice) Unmarshal(dAtA []byte) error { +func (m *ExchangeRateAtBlock) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1734,10 +1755,10 @@ func (m *DatedPrice) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DatedPrice: wiretype end group for non-group") + return fmt.Errorf("proto: ExchangeRateAtBlock: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DatedPrice: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ExchangeRateAtBlock: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1793,6 +1814,25 @@ func (m *DatedPrice) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockTimestampMs", wireType) + } + m.BlockTimestampMs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockTimestampMs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipOracle(dAtA[iNdEx:]) diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go index 4149e28c4..9498fb7d9 100644 --- a/x/oracle/types/query.pb.go +++ b/x/oracle/types/query.pb.go @@ -77,6 +77,12 @@ var xxx_messageInfo_QueryExchangeRateRequest proto.InternalMessageInfo type QueryExchangeRateResponse struct { // exchange_rate defines the exchange rate of assets voted by validators ExchangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"exchange_rate"` + // Block timestamp for the block where the oracle came to consensus for this + // price. This timestamp is a conventional Unix millisecond time, i.e. the + // number of milliseconds elapsed since January 1, 1970 UTC. + BlockTimestampMs int64 `protobuf:"varint,2,opt,name=block_timestamp_ms,json=blockTimestampMs,proto3" json:"block_timestamp_ms,omitempty"` + // Block height when the oracle came to consensus for this price. + BlockHeight uint64 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` } func (m *QueryExchangeRateResponse) Reset() { *m = QueryExchangeRateResponse{} } @@ -112,6 +118,20 @@ func (m *QueryExchangeRateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryExchangeRateResponse proto.InternalMessageInfo +func (m *QueryExchangeRateResponse) GetBlockTimestampMs() int64 { + if m != nil { + return m.BlockTimestampMs + } + return 0 +} + +func (m *QueryExchangeRateResponse) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + // QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC // method. type QueryExchangeRatesRequest struct { @@ -150,65 +170,6 @@ func (m *QueryExchangeRatesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryExchangeRatesRequest proto.InternalMessageInfo -// QueryDatedExchangeRateResponse is the request type for the -// Query/DatedExchangeRate RPC method. -type QueryDatedExchangeRateResponse struct { - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` - // Block timestamp for the block where the oracle came to consensus for this - // price. This timestamp is a conventional Unix millisecond time, i.e. the - // number of milliseconds elapsed since January 1, 1970 UTC. - BlockTimestampMs int64 `protobuf:"varint,2,opt,name=block_timestamp_ms,json=blockTimestampMs,proto3" json:"block_timestamp_ms,omitempty"` - // Block height when the oracle came to consensus for this price. - BlockHeight uint64 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` -} - -func (m *QueryDatedExchangeRateResponse) Reset() { *m = QueryDatedExchangeRateResponse{} } -func (m *QueryDatedExchangeRateResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDatedExchangeRateResponse) ProtoMessage() {} -func (*QueryDatedExchangeRateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{3} -} -func (m *QueryDatedExchangeRateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDatedExchangeRateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDatedExchangeRateResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryDatedExchangeRateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDatedExchangeRateResponse.Merge(m, src) -} -func (m *QueryDatedExchangeRateResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDatedExchangeRateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDatedExchangeRateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDatedExchangeRateResponse proto.InternalMessageInfo - -func (m *QueryDatedExchangeRateResponse) GetBlockTimestampMs() int64 { - if m != nil { - return m.BlockTimestampMs - } - return 0 -} - -func (m *QueryDatedExchangeRateResponse) GetBlockHeight() uint64 { - if m != nil { - return m.BlockHeight - } - return 0 -} - // QueryExchangeRatesResponse is response type for the // Query/ExchangeRates RPC method. type QueryExchangeRatesResponse struct { @@ -221,7 +182,7 @@ func (m *QueryExchangeRatesResponse) Reset() { *m = QueryExchangeRatesRe func (m *QueryExchangeRatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryExchangeRatesResponse) ProtoMessage() {} func (*QueryExchangeRatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{4} + return fileDescriptor_16aef2382d1249a8, []int{3} } func (m *QueryExchangeRatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -265,7 +226,7 @@ func (m *QueryActivesRequest) Reset() { *m = QueryActivesRequest{} } func (m *QueryActivesRequest) String() string { return proto.CompactTextString(m) } func (*QueryActivesRequest) ProtoMessage() {} func (*QueryActivesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{5} + return fileDescriptor_16aef2382d1249a8, []int{4} } func (m *QueryActivesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -305,7 +266,7 @@ func (m *QueryActivesResponse) Reset() { *m = QueryActivesResponse{} } func (m *QueryActivesResponse) String() string { return proto.CompactTextString(m) } func (*QueryActivesResponse) ProtoMessage() {} func (*QueryActivesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{6} + return fileDescriptor_16aef2382d1249a8, []int{5} } func (m *QueryActivesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -343,7 +304,7 @@ func (m *QueryVoteTargetsRequest) Reset() { *m = QueryVoteTargetsRequest func (m *QueryVoteTargetsRequest) String() string { return proto.CompactTextString(m) } func (*QueryVoteTargetsRequest) ProtoMessage() {} func (*QueryVoteTargetsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{7} + return fileDescriptor_16aef2382d1249a8, []int{6} } func (m *QueryVoteTargetsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -384,7 +345,7 @@ func (m *QueryVoteTargetsResponse) Reset() { *m = QueryVoteTargetsRespon func (m *QueryVoteTargetsResponse) String() string { return proto.CompactTextString(m) } func (*QueryVoteTargetsResponse) ProtoMessage() {} func (*QueryVoteTargetsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{8} + return fileDescriptor_16aef2382d1249a8, []int{7} } func (m *QueryVoteTargetsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -424,7 +385,7 @@ func (m *QueryFeederDelegationRequest) Reset() { *m = QueryFeederDelegat func (m *QueryFeederDelegationRequest) String() string { return proto.CompactTextString(m) } func (*QueryFeederDelegationRequest) ProtoMessage() {} func (*QueryFeederDelegationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{9} + return fileDescriptor_16aef2382d1249a8, []int{8} } func (m *QueryFeederDelegationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -464,7 +425,7 @@ func (m *QueryFeederDelegationResponse) Reset() { *m = QueryFeederDelega func (m *QueryFeederDelegationResponse) String() string { return proto.CompactTextString(m) } func (*QueryFeederDelegationResponse) ProtoMessage() {} func (*QueryFeederDelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{10} + return fileDescriptor_16aef2382d1249a8, []int{9} } func (m *QueryFeederDelegationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -511,7 +472,7 @@ func (m *QueryMissCounterRequest) Reset() { *m = QueryMissCounterRequest func (m *QueryMissCounterRequest) String() string { return proto.CompactTextString(m) } func (*QueryMissCounterRequest) ProtoMessage() {} func (*QueryMissCounterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{11} + return fileDescriptor_16aef2382d1249a8, []int{10} } func (m *QueryMissCounterRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -551,7 +512,7 @@ func (m *QueryMissCounterResponse) Reset() { *m = QueryMissCounterRespon func (m *QueryMissCounterResponse) String() string { return proto.CompactTextString(m) } func (*QueryMissCounterResponse) ProtoMessage() {} func (*QueryMissCounterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{12} + return fileDescriptor_16aef2382d1249a8, []int{11} } func (m *QueryMissCounterResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -598,7 +559,7 @@ func (m *QueryAggregatePrevoteRequest) Reset() { *m = QueryAggregatePrev func (m *QueryAggregatePrevoteRequest) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePrevoteRequest) ProtoMessage() {} func (*QueryAggregatePrevoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{13} + return fileDescriptor_16aef2382d1249a8, []int{12} } func (m *QueryAggregatePrevoteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -639,7 +600,7 @@ func (m *QueryAggregatePrevoteResponse) Reset() { *m = QueryAggregatePre func (m *QueryAggregatePrevoteResponse) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePrevoteResponse) ProtoMessage() {} func (*QueryAggregatePrevoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{14} + return fileDescriptor_16aef2382d1249a8, []int{13} } func (m *QueryAggregatePrevoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -684,7 +645,7 @@ func (m *QueryAggregatePrevotesRequest) Reset() { *m = QueryAggregatePre func (m *QueryAggregatePrevotesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePrevotesRequest) ProtoMessage() {} func (*QueryAggregatePrevotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{15} + return fileDescriptor_16aef2382d1249a8, []int{14} } func (m *QueryAggregatePrevotesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -725,7 +686,7 @@ func (m *QueryAggregatePrevotesResponse) Reset() { *m = QueryAggregatePr func (m *QueryAggregatePrevotesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePrevotesResponse) ProtoMessage() {} func (*QueryAggregatePrevotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{16} + return fileDescriptor_16aef2382d1249a8, []int{15} } func (m *QueryAggregatePrevotesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -772,7 +733,7 @@ func (m *QueryAggregateVoteRequest) Reset() { *m = QueryAggregateVoteReq func (m *QueryAggregateVoteRequest) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVoteRequest) ProtoMessage() {} func (*QueryAggregateVoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{17} + return fileDescriptor_16aef2382d1249a8, []int{16} } func (m *QueryAggregateVoteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -813,7 +774,7 @@ func (m *QueryAggregateVoteResponse) Reset() { *m = QueryAggregateVoteRe func (m *QueryAggregateVoteResponse) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVoteResponse) ProtoMessage() {} func (*QueryAggregateVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{18} + return fileDescriptor_16aef2382d1249a8, []int{17} } func (m *QueryAggregateVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -858,7 +819,7 @@ func (m *QueryAggregateVotesRequest) Reset() { *m = QueryAggregateVotesR func (m *QueryAggregateVotesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVotesRequest) ProtoMessage() {} func (*QueryAggregateVotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{19} + return fileDescriptor_16aef2382d1249a8, []int{18} } func (m *QueryAggregateVotesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -899,7 +860,7 @@ func (m *QueryAggregateVotesResponse) Reset() { *m = QueryAggregateVotes func (m *QueryAggregateVotesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVotesResponse) ProtoMessage() {} func (*QueryAggregateVotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{20} + return fileDescriptor_16aef2382d1249a8, []int{19} } func (m *QueryAggregateVotesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -943,7 +904,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{21} + return fileDescriptor_16aef2382d1249a8, []int{20} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -982,7 +943,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{22} + return fileDescriptor_16aef2382d1249a8, []int{21} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1022,7 +983,6 @@ func init() { proto.RegisterType((*QueryExchangeRateRequest)(nil), "nibiru.oracle.v1.QueryExchangeRateRequest") proto.RegisterType((*QueryExchangeRateResponse)(nil), "nibiru.oracle.v1.QueryExchangeRateResponse") proto.RegisterType((*QueryExchangeRatesRequest)(nil), "nibiru.oracle.v1.QueryExchangeRatesRequest") - proto.RegisterType((*QueryDatedExchangeRateResponse)(nil), "nibiru.oracle.v1.QueryDatedExchangeRateResponse") proto.RegisterType((*QueryExchangeRatesResponse)(nil), "nibiru.oracle.v1.QueryExchangeRatesResponse") proto.RegisterType((*QueryActivesRequest)(nil), "nibiru.oracle.v1.QueryActivesRequest") proto.RegisterType((*QueryActivesResponse)(nil), "nibiru.oracle.v1.QueryActivesResponse") @@ -1047,84 +1007,80 @@ func init() { func init() { proto.RegisterFile("nibiru/oracle/v1/query.proto", fileDescriptor_16aef2382d1249a8) } var fileDescriptor_16aef2382d1249a8 = []byte{ - // 1218 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x98, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 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, 0x37, - 0x0a, 0xc5, 0xd9, 0x93, 0xd2, 0x52, 0x9e, 0xb9, 0x90, 0x47, 0xda, 0x01, 0xfc, 0x15, 0x82, 0x6c, - 0x64, 0xde, 0xe3, 0x8b, 0x8a, 0x2e, 0x49, 0xbb, 0x50, 0x9c, 0x4f, 0x93, 0x9a, 0xf2, 0xb0, 0x85, - 0x50, 0x51, 0x87, 0x81, 0x7f, 0x42, 0x90, 0xef, 0x9d, 0xdd, 0x58, 0x57, 0xf4, 0x54, 0xb8, 0x86, - 0xa2, 0x91, 0x3a, 0x5f, 0x82, 0xae, 0x0b, 0xd0, 0x57, 0xf0, 0x9a, 0x02, 0xb4, 0xfb, 0xa6, 0x33, - 0xe3, 0x6e, 0xfc, 0xd5, 0xff, 0xc8, 0x08, 0xad, 0x43, 0x70, 0x4b, 0xb2, 0x91, 0x31, 0xaf, 0x94, - 0x34, 0x69, 0x2b, 0x94, 0x92, 0xf6, 0x71, 0x0d, 0xda, 0x6b, 0x82, 0x74, 0x0d, 0xbf, 0x34, 0x00, - 0x69, 0x60, 0x2d, 0xf0, 0x2f, 0x08, 0xf2, 0xbd, 0x73, 0x55, 0x29, 0xb0, 0xc2, 0x78, 0x28, 0x05, - 0x56, 0xd9, 0x0a, 0xed, 0xba, 0xc0, 0xbe, 0x8a, 0xb7, 0x06, 0xc0, 0x4e, 0x0c, 0x7a, 0xfc, 0x03, - 0x82, 0xf1, 0x84, 0x37, 0xc0, 0x69, 0xa1, 0xd8, 0x49, 0xcf, 0x92, 0xd2, 0x76, 0x68, 0x57, 0xc4, - 0x36, 0x2e, 0xe3, 0x4b, 0x27, 0x6f, 0x23, 0x69, 0x4f, 0xf0, 0x8f, 0x08, 0x72, 0xb1, 0x39, 0xab, - 0x7c, 0xa0, 0xfa, 0x39, 0x0e, 0xe5, 0x03, 0xd5, 0xd7, 0x50, 0x68, 0xd7, 0x04, 0xea, 0x26, 0x5e, - 0x57, 0xa3, 0xd6, 0xed, 0x13, 0x15, 0x17, 0x72, 0x7f, 0x87, 0x60, 0x2c, 0xee, 0x0f, 0x70, 0x2a, - 0x96, 0xae, 0xd0, 0x4b, 0x29, 0xb3, 0x25, 0xfa, 0x9a, 0x40, 0x5f, 0xc5, 0xcb, 0x8f, 0xa3, 0x72, - 0x28, 0xf1, 0x87, 0x30, 0x12, 0xda, 0x00, 0x7c, 0x41, 0xd1, 0x33, 0xe6, 0x36, 0x8a, 0x33, 0x27, - 0x64, 0x49, 0xa2, 0x19, 0x41, 0x54, 0xc6, 0x53, 0xca, 0x87, 0x4c, 0x58, 0x8f, 0x6b, 0x0f, 0x0e, - 0x4b, 0xe8, 0xe1, 0x61, 0x09, 0xfd, 0x79, 0x58, 0x42, 0x9f, 0x1f, 0x95, 0x32, 0x0f, 0x8f, 0x4a, - 0x99, 0xdf, 0x8e, 0x4a, 0x99, 0x1b, 0x46, 0x8a, 0x9f, 0x4a, 0xb2, 0xa6, 0xf8, 0x69, 0x5c, 0x1b, - 0x11, 0x7f, 0x86, 0x58, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0xb7, 0xc9, 0xcd, 0x87, 0x2b, 0x11, - 0x00, 0x00, + // 1166 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x97, 0xcf, 0x6f, 0x1b, 0x45, + 0x1b, 0xc7, 0x3d, 0x4d, 0xde, 0xf4, 0xe5, 0x71, 0x9c, 0x3a, 0x43, 0x10, 0xae, 0x9b, 0xd8, 0xe9, + 0xd2, 0x44, 0x69, 0x93, 0xec, 0x92, 0xa4, 0x2a, 0x0a, 0x14, 0x41, 0x7e, 0x50, 0x51, 0xd4, 0x40, + 0x30, 0x51, 0x84, 0x7a, 0xb1, 0xc6, 0xeb, 0xe9, 0x66, 0x55, 0x7b, 0xd7, 0xdd, 0x19, 0x9b, 0x46, + 0x85, 0x4b, 0x05, 0x88, 0x23, 0x12, 0x42, 0xdc, 0xa0,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 0x79, 0x92, 0x15, 0x25, + 0x15, 0x81, 0x49, 0xd2, 0x8d, 0x55, 0x5b, 0x41, 0x50, 0x54, 0xcd, 0xae, 0xea, 0xc9, 0xa3, 0x11, + 0x96, 0x89, 0x1e, 0x04, 0x59, 0x72, 0x73, 0xd4, 0xdf, 0x26, 0x95, 0x3c, 0xe9, 0x6b, 0xa5, 0x95, + 0x15, 0x0c, 0xe1, 0x8e, 0xfc, 0x04, 0x41, 0x49, 0x95, 0x21, 0x31, 0x4d, 0xc0, 0x09, 0xcc, 0xee, + 0x11, 0x1e, 0x8e, 0x73, 0xb2, 0x9f, 0x93, 0x69, 0x37, 0xe4, 0xfd, 0x12, 0x3e, 0xbd, 0xff, 0x34, + 0xda, 0x77, 0xe4, 0x7d, 0xd4, 0x57, 0x4d, 0x0e, 0xf4, 0x3e, 0x4c, 0xf4, 0x06, 0x8a, 0x88, 0xbe, + 0x98, 0x72, 0x98, 0xfd, 0xde, 0x24, 0x39, 0x12, 0xed, 0xa0, 0x4d, 0x0f, 0xea, 0x1b, 0x6a, 0x7d, + 0x08, 0xe7, 0x06, 0x46, 0x25, 0xd6, 0x4d, 0x38, 0x13, 0xc7, 0xea, 0x8a, 0x3c, 0x04, 0xd7, 0x44, + 0x8c, 0x8b, 0x69, 0x53, 0x80, 0x45, 0xeb, 0x5d, 0xe2, 0x91, 0x66, 0x08, 0xb4, 0x23, 0x2f, 0xcc, + 0xee, 0xaa, 0x04, 0xb9, 0x02, 0x63, 0x2d, 0xb1, 0x22, 0x75, 0x29, 0x24, 0xfb, 0x07, 0x4f, 0xc8, + 0x66, 0x32, 0x7b, 0xf5, 0xe7, 0x33, 0xf0, 0x3f, 0x51, 0x0f, 0x7f, 0x89, 0x60, 0x3c, 0x4a, 0x86, + 0x2f, 0x25, 0x4b, 0xa8, 0xac, 0xb8, 0xb8, 0x98, 0x2a, 0x37, 0x60, 0xd5, 0x96, 0xee, 0xff, 0xf2, + 0xe7, 0x17, 0xa7, 0xe6, 0xf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0x81, 0x55, 0x76, 0xad, + 0xdd, 0x10, 0xd8, 0xd7, 0xf0, 0xf6, 0x10, 0xd8, 0x09, 0x03, 0xc5, 0x3f, 0x20, 0x98, 0x4c, 0x78, + 0x2e, 0x4e, 0x0b, 0x15, 0x6e, 0xe5, 0x17, 0xd3, 0x3f, 0x20, 0xc7, 0xb8, 0x2a, 0xc6, 0xb8, 0x82, + 0x2f, 0x9f, 0x3c, 0x46, 0xd2, 0xf6, 0xf1, 0x8f, 0x08, 0x72, 0x31, 0xff, 0x52, 0x5e, 0x50, 0x83, + 0x9c, 0x5c, 0x79, 0x41, 0x0d, 0x34, 0x6a, 0xed, 0xba, 0x40, 0xdd, 0xc2, 0x1b, 0x6a, 0xd4, 0xba, + 0x7d, 0xa2, 0xe2, 0x42, 0xee, 0xef, 0x10, 0x4c, 0xc4, 0x7d, 0x17, 0xa7, 0x62, 0x09, 0x85, 0x5e, + 0x4e, 0x99, 0x2d, 0xd1, 0xd7, 0x05, 0xfa, 0x1a, 0x5e, 0xf9, 0x27, 0x2a, 0x07, 0x12, 0x7f, 0x08, + 0x63, 0x81, 0xbd, 0xe2, 0x0b, 0x8a, 0x9e, 0x31, 0x17, 0x2f, 0xce, 0x9d, 0x90, 0x25, 0x89, 0xe6, + 0x04, 0x51, 0x19, 0xcf, 0x28, 0x2f, 0x32, 0x61, 0xe9, 0xd7, 0x1f, 0x1d, 0x95, 0xd0, 0xe3, 0xa3, + 0x12, 0xfa, 0xe3, 0xa8, 0x84, 0x3e, 0x3f, 0x2e, 0x65, 0x1e, 0x1f, 0x97, 0x32, 0xbf, 0x1e, 0x97, + 0x32, 0x37, 0x8d, 0x14, 0x9f, 0x20, 0xb2, 0xa6, 0xf8, 0x2c, 0xad, 0x8d, 0x89, 0xcf, 0xee, 0xb5, + 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x14, 0xd6, 0x3e, 0x1e, 0x1b, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1139,12 +1095,11 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // ExchangeRate returns exchange rate of a pair + // ExchangeRate returns exchange rate of a pair along with the block height and + // block time that the exchange rate was set by the oracle module. ExchangeRate(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryExchangeRateResponse, error) // ExchangeRateTwap returns twap exchange rate of a pair ExchangeRateTwap(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryExchangeRateResponse, error) - // DatedExchangeRate returns latest price of a pair - DatedExchangeRate(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryDatedExchangeRateResponse, error) // ExchangeRates returns exchange rates of all pairs ExchangeRates(ctx context.Context, in *QueryExchangeRatesRequest, opts ...grpc.CallOption) (*QueryExchangeRatesResponse, error) // Actives returns all active pairs @@ -1193,15 +1148,6 @@ func (c *queryClient) ExchangeRateTwap(ctx context.Context, in *QueryExchangeRat return out, nil } -func (c *queryClient) DatedExchangeRate(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryDatedExchangeRateResponse, error) { - out := new(QueryDatedExchangeRateResponse) - err := c.cc.Invoke(ctx, "/nibiru.oracle.v1.Query/DatedExchangeRate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) ExchangeRates(ctx context.Context, in *QueryExchangeRatesRequest, opts ...grpc.CallOption) (*QueryExchangeRatesResponse, error) { out := new(QueryExchangeRatesResponse) err := c.cc.Invoke(ctx, "/nibiru.oracle.v1.Query/ExchangeRates", in, out, opts...) @@ -1294,12 +1240,11 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { - // ExchangeRate returns exchange rate of a pair + // ExchangeRate returns exchange rate of a pair along with the block height and + // block time that the exchange rate was set by the oracle module. ExchangeRate(context.Context, *QueryExchangeRateRequest) (*QueryExchangeRateResponse, error) // ExchangeRateTwap returns twap exchange rate of a pair ExchangeRateTwap(context.Context, *QueryExchangeRateRequest) (*QueryExchangeRateResponse, error) - // DatedExchangeRate returns latest price of a pair - DatedExchangeRate(context.Context, *QueryExchangeRateRequest) (*QueryDatedExchangeRateResponse, error) // ExchangeRates returns exchange rates of all pairs ExchangeRates(context.Context, *QueryExchangeRatesRequest) (*QueryExchangeRatesResponse, error) // Actives returns all active pairs @@ -1332,9 +1277,6 @@ func (*UnimplementedQueryServer) ExchangeRate(ctx context.Context, req *QueryExc func (*UnimplementedQueryServer) ExchangeRateTwap(ctx context.Context, req *QueryExchangeRateRequest) (*QueryExchangeRateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ExchangeRateTwap not implemented") } -func (*UnimplementedQueryServer) DatedExchangeRate(ctx context.Context, req *QueryExchangeRateRequest) (*QueryDatedExchangeRateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DatedExchangeRate not implemented") -} func (*UnimplementedQueryServer) ExchangeRates(ctx context.Context, req *QueryExchangeRatesRequest) (*QueryExchangeRatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ExchangeRates not implemented") } @@ -1406,24 +1348,6 @@ func _Query_ExchangeRateTwap_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } -func _Query_DatedExchangeRate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryExchangeRateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DatedExchangeRate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nibiru.oracle.v1.Query/DatedExchangeRate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DatedExchangeRate(ctx, req.(*QueryExchangeRateRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_ExchangeRates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryExchangeRatesRequest) if err := dec(in); err != nil { @@ -1616,10 +1540,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ExchangeRateTwap", Handler: _Query_ExchangeRateTwap_Handler, }, - { - MethodName: "DatedExchangeRate", - Handler: _Query_DatedExchangeRate_Handler, - }, { MethodName: "ExchangeRates", Handler: _Query_ExchangeRates_Handler, @@ -1718,6 +1638,16 @@ func (m *QueryExchangeRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if m.BlockHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x18 + } + if m.BlockTimestampMs != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlockTimestampMs)) + i-- + dAtA[i] = 0x10 + } { size := m.ExchangeRate.Size() i -= size @@ -1754,49 +1684,6 @@ func (m *QueryExchangeRatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryDatedExchangeRateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryDatedExchangeRateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDatedExchangeRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BlockHeight != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BlockHeight)) - i-- - dAtA[i] = 0x18 - } - if m.BlockTimestampMs != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BlockTimestampMs)) - i-- - dAtA[i] = 0x10 - } - { - size := m.Price.Size() - i -= size - if _, err := m.Price.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func (m *QueryExchangeRatesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2404,32 +2291,21 @@ func (m *QueryExchangeRateResponse) Size() (n int) { _ = l l = m.ExchangeRate.Size() n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryExchangeRatesRequest) Size() (n int) { - if m == nil { - return 0 + if m.BlockTimestampMs != 0 { + n += 1 + sovQuery(uint64(m.BlockTimestampMs)) + } + if m.BlockHeight != 0 { + n += 1 + sovQuery(uint64(m.BlockHeight)) } - var l int - _ = l return n } -func (m *QueryDatedExchangeRateResponse) Size() (n int) { +func (m *QueryExchangeRatesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.Price.Size() - n += 1 + l + sovQuery(uint64(l)) - if m.BlockTimestampMs != 0 { - n += 1 + sovQuery(uint64(m.BlockTimestampMs)) - } - if m.BlockHeight != 0 { - n += 1 + sovQuery(uint64(m.BlockHeight)) - } return n } @@ -2816,56 +2692,44 @@ func (m *QueryExchangeRateResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockTimestampMs", wireType) } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryExchangeRatesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery + m.BlockTimestampMs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockTimestampMs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { - return io.ErrUnexpectedEOF + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryExchangeRatesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryExchangeRatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2887,7 +2751,7 @@ func (m *QueryExchangeRatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDatedExchangeRateResponse) Unmarshal(dAtA []byte) error { +func (m *QueryExchangeRatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2910,84 +2774,12 @@ func (m *QueryDatedExchangeRateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDatedExchangeRateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryExchangeRatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDatedExchangeRateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryExchangeRatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockTimestampMs", wireType) - } - m.BlockTimestampMs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockTimestampMs |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) - } - m.BlockHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/oracle/types/query.pb.gw.go b/x/oracle/types/query.pb.gw.go index c9436368d..f8af1a4f8 100644 --- a/x/oracle/types/query.pb.gw.go +++ b/x/oracle/types/query.pb.gw.go @@ -105,42 +105,6 @@ func local_request_Query_ExchangeRateTwap_0(ctx context.Context, marshaler runti } -var ( - filter_Query_DatedExchangeRate_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_DatedExchangeRate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryExchangeRateRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DatedExchangeRate_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.DatedExchangeRate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DatedExchangeRate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryExchangeRateRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DatedExchangeRate_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.DatedExchangeRate(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_ExchangeRates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryExchangeRatesRequest var metadata runtime.ServerMetadata @@ -517,29 +481,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_DatedExchangeRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_DatedExchangeRate_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_DatedExchangeRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_ExchangeRates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -851,26 +792,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_DatedExchangeRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_DatedExchangeRate_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_DatedExchangeRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_ExchangeRates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1079,8 +1000,6 @@ var ( pattern_Query_ExchangeRateTwap_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nibiru", "oracle", "v1beta1", "exchange_rate_twap"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_DatedExchangeRate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nibiru", "oracle", "v1beta1", "dated_exchange_rate"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ExchangeRates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"nibiru", "oracle", "v1beta1", "pairs", "exchange_rates"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Actives_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"nibiru", "oracle", "v1beta1", "pairs", "actives"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1107,8 +1026,6 @@ var ( forward_Query_ExchangeRateTwap_0 = runtime.ForwardResponseMessage - forward_Query_DatedExchangeRate_0 = runtime.ForwardResponseMessage - forward_Query_ExchangeRates_0 = runtime.ForwardResponseMessage forward_Query_Actives_0 = runtime.ForwardResponseMessage