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

Test VMC contract in golang #21

Merged
merged 19 commits into from
Feb 16, 2018

Conversation

enriquefynn
Copy link
Contributor

@enriquefynn enriquefynn commented Feb 7, 2018

Unpacked arguments for the CollationAdded event
New VMC go bindings

addr = crypto.PubkeyToAddress(key.PublicKey)
)

func TestContractCreation(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you be more specific? This is testing a lot of things other than just deploying the contract.

Please split up these into smaller tests where each test method has a suite of test conditions and expected output.

accountBalance, _ := new(big.Int).SetString("1000000000000000000000", 10)
contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: accountBalance}})
transactOpts := bind.NewKeyedTransactor(key)
callOpts := bind.CallOpts{}
Copy link
Member

Choose a reason for hiding this comment

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

This can be inline on line 33

contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: accountBalance}})
transactOpts := bind.NewKeyedTransactor(key)
callOpts := bind.CallOpts{}
filterOpts := bind.FilterOpts{}
Copy link
Member

Choose a reason for hiding this comment

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

This can be inline on line 47

if depositsIterator.Event.Index.Cmp(big.NewInt(0)) != 0 {
t.Fatalf("Validator index mismatch: %d should be 0", depositsIterator.Event.Index)
}
fmt.Printf("%x\n", depositsIterator.Event.Validator)
Copy link
Member

Choose a reason for hiding this comment

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

No need for this print statement

Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

Travis seems flaky so I think we can ignore it for now.

@prestonvanloon prestonvanloon merged commit c94c2d4 into prysmaticlabs:master Feb 16, 2018
prestonvanloon added a commit that referenced this pull request Jul 22, 2018
prestonvanloon added a commit that referenced this pull request Jul 22, 2018
Test VMC contract in golang

Former-commit-id: f0ede01
prestonvanloon added a commit that referenced this pull request Jul 22, 2018
Test VMC contract in golang

Former-commit-id: e807ac9db2ec99d4ec6ebad36fee0a2c28726de8 [formerly f0ede01]
Former-commit-id: eb9af3a
protolambda pushed a commit to protolambda/prysm that referenced this pull request Oct 9, 2022
EIP-4844 Blobs sidecar API endpoint (rebased)
Redidacove pushed a commit to Redidacove/prysm that referenced this pull request Aug 13, 2024
Co-authored-by: Mário Havel <61149543+taxmeifyoucan@users.noreply.github.com>
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.

2 participants