Skip to content

Comments

05 stable update tests#226

Merged
Ivshti merged 6 commits intoadexAI:05-stablefrom
samparsky:05-stable-update-tests
Nov 4, 2019
Merged

05 stable update tests#226
Ivshti merged 6 commits intoadexAI:05-stablefrom
samparsky:05-stable-update-tests

Conversation

@samparsky
Copy link
Contributor

Fix #223

Copy link
Contributor

@Ivshti Ivshti left a comment

Choose a reason for hiding this comment

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

That's a great job, amazing!

But there's a few things that need to be addressed


tape('submit events and ensure they are accounted for', async function(t) {
const evs = genEvents(3).concat(genEvents(2, 'anotherPublisher'))
const evs = genEvents(3).concat(genEvents(2, '0x48b6d5748885988cb657a06647c05fc2af1ffacf'))
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe put this in the dummy data constants (dummyVals)

await testRejectState(t, 'InvalidSignature', function(newState) {
// increase the balance, so we effectively end up with a new state
const balances = { ...newState.balances, someoneElse: '1' }
const balances = { ...newState.balances, '0x033ed90e0fec3f3ea1c9b005c724d704501e0196': '1' }
Copy link
Contributor

Choose a reason for hiding this comment

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

again, consider putting this in the dummyVals but I have an important question here:

how do we make sure that 0x033 does not override something that's already in newState.balances?

also, in the second case, how do we ensure that '0x033' was not previously present in the newState.balances
how about generating a random addr in the second case?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see now that this is the creator from dummyVals

I think that you should indeed gen a random addr here, in this test and in the next (const fakeBalances=)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah true, I have added random address generation

test/lib.js Outdated
return Promise.all([exec(leaderTick), exec(followerTick)])
}

function nonce() {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a more elegant way to do this?

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 made the change to use current timestamp as nonce

withdrawPeriodStart: new Date('2200-01-01').getTime(),
minPerImpression: '1',
maxPerImpression: '1',
validators: [
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be removed because it was already in the dummyVals.channel.spec, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

@samparsky samparsky force-pushed the 05-stable-update-tests branch from 194365e to e7f364e Compare November 4, 2019 16:53
`./bin/validatorWorker.js --single-tick --adapter=dummy --dummyIdentity=awesomeFollower --sentryUrl=http://localhost:8006`
)
])
let leaderTick = `./bin/validatorWorker.js --single-tick --adapter=dummy --dummyIdentity=0xce07cbb7e054514d590a0262c93070d838bfba2e --sentryUrl=http://localhost:8005`
Copy link
Contributor

Choose a reason for hiding this comment

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

can we avoid hardcoding those here..we have dummyVals

if (process.env.RUST_VALIDATOR_WORKER) {
leaderTick = `RUST_BACKTRACE=1 ${
process.env.RUST_VALIDATOR_WORKER
} -a dummy -i 0xce07cbb7e054514d590a0262c93070d838bfba2e -u http://localhost:8005 -t`
Copy link
Contributor

Choose a reason for hiding this comment

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

can we avoid hardcoding those here..we have dummyVals

@Ivshti Ivshti merged commit 34a665a into adexAI:05-stable Nov 4, 2019
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.

tests: Update tests to enable compatibility with Rust validator_worker

2 participants