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

tests: itests: test creating a contract and sending value #10162

Merged
merged 3 commits into from
Feb 9, 2023

Conversation

snissn
Copy link
Contributor

@snissn snissn commented Feb 1, 2023

Related Issues

filecoin-project/ref-fvm#1491

Proposed Changes

Add a test to deploy a contract that has a payable constructor. This constructor creates a new contract that it forwards value to. Test the second contract has the initial value.

Additional Info

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

@snissn snissn marked this pull request as ready for review February 1, 2023 07:01
@snissn snissn requested a review from a team as a code owner February 1, 2023 07:01
@snissn snissn enabled auto-merge February 1, 2023 07:14
@snissn snissn disabled auto-merge February 1, 2023 07:14

func (e *EVM) DeployContractFromFilename(ctx context.Context, binFilename string) (address.Address, address.Address) {
func (e *EVM) DeployContractFromFilenameValue(ctx context.Context, binFilename string, value big.Int) (address.Address, address.Address) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could be named DeployContractFromFileWithValue.

I think all the functions here should end with WithValue instead of just Value. I think the latter makes sense to us, but is probably ambiguous to anyone looking at this code fresh.

Copy link
Member

Choose a reason for hiding this comment

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

There are a lot of variants here -- looks like an API cartesian product situation. This is where the functional options pattern comes in handy: https://golang.cafe/blog/golang-functional-options-pattern.html.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @raulk @geoff-vball ! This feedback is super helpful! I have updated the PR to use WithValue

@jennijuju jennijuju modified the milestone: Network v18 Feb 6, 2023
@raulk raulk self-requested a review February 8, 2023 16:07
@magik6k magik6k merged commit d84479b into release/v1.20.0 Feb 9, 2023
@magik6k magik6k deleted the mikers/deployValueTest2 branch February 9, 2023 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants