Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fevm_test: delegate call test #9990

Closed
wants to merge 264 commits into from
Closed

Conversation

snissn
Copy link
Contributor

@snissn snissn commented Jan 12, 2023

Related Issues

filecoin-project/ref-fvm#1320

Proposed Changes

refactor of fevm_test, addition of delegate call test and a script to compile the .sol solidity files to .bin'

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

vyzo and others added 30 commits November 9, 2022 19:30
Make it use GasEstimateMessageGas, which applies overestimation
by default. This accounts for inclusion costs.
Also updates the actors to accommodate this change, and fix a bug in
looking up addresses for f4 actors.
We need to add full FEVM state support, but that will require merging
master. This is enough for now.

fixes filecoin-project/ref-fvm#1022
@snissn snissn requested a review from a team as a code owner January 12, 2023 04:43
@snissn
Copy link
Contributor Author

snissn commented Jan 12, 2023

ci/circleci: lint-all and ci/circleci: test-itest-eth_transactions seem to be failing from commit #3456d90e0d which is unrelated to this PR

ci/circleci: test-itest-fevm failed due to an SSL error unrelated to this commit and should be rerun by someoine with the correct permissions

curl: (56) OpenSSL SSL_read: Connection reset by peer, errno 104
[download_release_tarball] failed to download release asset 
+ return 1

inputData := append(inputDataContract, inputDataValue...)

result := invokeContract(t, ctx, client, fromAddr, storageAddr, "setVars(address,uint256)", inputData)
expectedResult, err := hex.DecodeString("0000000000000000000000000000000000000000000000000000000000000007")
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment specifying what this byte string means would be helpful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ty! will add

fromId, err := client.StateLookupID(ctx, from, types.EmptyTSK)
require.NoError(t, err)

senderEthAddr, err := ethtypes.EthAddressFromFilecoinAddress(fromId)
Copy link
Contributor

Choose a reason for hiding this comment

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

fromId is going to be an ID address and this API will always give you an 0xff eth address which isn't always accurate if we have an f4 address available

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry i am new don't understand this yet - should i make any changes?

@@ -1 +1 @@
608060405234801561001057600080fd5b506127106000803273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061051c806100656000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80637bd703e81461004657806390b98a1114610076578063f8b2cb4f146100a6575b600080fd5b610060600480360381019061005b919061030a565b6100d6565b60405161006d9190610350565b60405180910390f35b610090600480360381019061008b9190610397565b6100f4565b60405161009d91906103f2565b60405180910390f35b6100c060048036038101906100bb919061030a565b61025f565b6040516100cd9190610350565b60405180910390f35b600060026100e38361025f565b6100ed919061043c565b9050919050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156101455760009050610259565b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610193919061047e565b92505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546101e891906104b2565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161024c9190610350565b60405180910390a3600190505b92915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102d7826102ac565b9050919050565b6102e7816102cc565b81146102f257600080fd5b50565b600081359050610304816102de565b92915050565b6000602082840312156103205761031f6102a7565b5b600061032e848285016102f5565b91505092915050565b6000819050919050565b61034a81610337565b82525050565b60006020820190506103656000830184610341565b92915050565b61037481610337565b811461037f57600080fd5b50565b6000813590506103918161036b565b92915050565b600080604083850312156103ae576103ad6102a7565b5b60006103bc858286016102f5565b92505060206103cd85828601610382565b9150509250929050565b60008115159050919050565b6103ec816103d7565b82525050565b600060208201905061040760008301846103e3565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061044782610337565b915061045283610337565b925082820261046081610337565b915082820484148315176104775761047661040d565b5b5092915050565b600061048982610337565b915061049483610337565b92508282039050818111156104ac576104ab61040d565b5b92915050565b60006104bd82610337565b91506104c883610337565b92508282019050808211156104e0576104df61040d565b5b9291505056fea26469706673582212205ede41ff9072784ccc19ac18de0781558d305a8139361fa85dc51a8614e47d8c64736f6c63430008110033
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I re-ran solidity compiler and don't know exactly how the previous binary file was compiled ie version of solidity and optimization settings. maybe ideally each test run should create a new .bin binary and these don't need to be in the repo, but i'm not sure the best way to package the solc compiler and there isn't a clean go binding


inputData, err := hex.DecodeString("000000000000000000000000ff00000000000000000000000000000000000064")
require.NoError(t, err)
func invokeContract(t *testing.T, ctx context.Context, client *kit.TestFullNode, fromAddr address.Address, idAddr address.Address, funcSignature string, inputData []byte) []byte {
Copy link
Contributor

Choose a reason for hiding this comment

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

As @arajasek mentioned, it would be nice to make these helpers available to other tests

@snissn
Copy link
Contributor Author

snissn commented Jan 13, 2023

can i have a suggestion on:

  • how / where to put the helpers available to other tests?
  • fromId is going to be an ID address and this API will always give you an 0xff eth address which isn't always accurate if we have an f4 address available

Base automatically changed from feat/nv18-fevm to release/v1.20.0 January 13, 2023 19:11
@arajasek
Copy link
Contributor

@snissn I'd suggest moving install contract to live in here as a more comprehensive version of DeployContract. I think it'll save some boilerplate in both existing and future tests.

I'm not sure which of the other methods are worth moving there. I'd say let's leave them where they are for now, and export them as we write more tests (and find a need for them).

@snissn snissn marked this pull request as draft January 14, 2023 01:12
@snissn snissn closed this Jan 14, 2023
@snissn snissn deleted the snissn/delegatecalltest branch January 14, 2023 07:19
@arajasek arajasek mentioned this pull request Jan 16, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.