-
Notifications
You must be signed in to change notification settings - Fork 117
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(integration-test): fixed tx-rollup-l2-address test for limanet #2171
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { Protocols } from "@taquito/taquito"; | ||
import { CONFIGS } from "./config"; | ||
import { UnitValue } from '@taquito/michelson-encoder'; | ||
import { Protocols } from "@taquito/taquito"; | ||
|
||
CONFIGS().forEach(({lib, setup, protocol, txRollupAddress}) => { | ||
CONFIGS().forEach(({ lib, setup, protocol, txRollupAddress, rpc }) => { | ||
const tezos = lib; | ||
const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; | ||
const kathmandunet = protocol === Protocols.PtKathman ? test : test.skip; | ||
const limanetAndAlpha = protocol === Protocols.PtLimaPtL || protocol === Protocols.ProtoALpha ? test : test.skip; | ||
|
||
describe(`Contract originations and method calls to test the type of tx_rollup_l2_address`, () => { | ||
describe(`Contract originations and method calls to test the type of tx_rollup_l2_address: ${rpc}`, () => { | ||
beforeEach(async (done) => { | ||
await setup(); | ||
done(); | ||
}) | ||
it(`Originate a contract with a hex string type tz1 & tz4 in initial storage tz4 & string`, async (done) => { | ||
|
||
kathmandunet(`Originate a contract with a hex string type tz1 & tz4 in initial storage tz4 & string`, async (done) => { | ||
const op = await tezos.contract.originate({ | ||
code: ` | ||
parameter (pair address tx_rollup_l2_address string); | ||
|
@@ -57,20 +59,84 @@ CONFIGS().forEach(({lib, setup, protocol, txRollupAddress}) => { | |
expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
|
||
const contract = await op.contract(); | ||
const symbolReturn = await contract.storage() | ||
expect(JSON.stringify(symbolReturn)).toEqual(JSON.stringify(UnitValue)) | ||
console.log(contract.address); | ||
|
||
const storage = await contract.storage(); | ||
expect(JSON.stringify(storage)).toEqual(JSON.stringify(UnitValue)); | ||
|
||
const ticketDeposit = await contract.methods.default(txRollupAddress, 'tz4VHgLiRx5ZZjwU2QaybHc11EMJk3NcyvVc', '1').send(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. curious, since we are passing a tz4 address that lives in our txRollup. Does that mean we are using the same rollup node for all TORU tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tz4 address doesn't live in our txRollup. It is like when we are using a tezos private key, we can use the same key on all networks if we want to. |
||
await ticketDeposit.confirmation(); | ||
|
||
expect(ticketDeposit.hash).toBeDefined(); | ||
expect(ticketDeposit.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
expect(JSON.stringify(await contract.storage())).toEqual(JSON.stringify(UnitValue)) | ||
expect(JSON.stringify(await contract.storage())).toEqual(JSON.stringify(UnitValue)); | ||
done(); | ||
}) | ||
|
||
limanetAndAlpha(`Originate a contract with a hex string type tz1 & tz4 in initial storage tz4 & string`, async (done) => { | ||
const op = await tezos.contract.originate({ | ||
code: ` | ||
parameter (pair address tx_rollup_l2_address string); | ||
storage (unit); | ||
code { | ||
# cast the address to contract type | ||
CAR; | ||
UNPAIR; | ||
CONTRACT %deposit (pair (ticket (pair unit string)) tx_rollup_l2_address); | ||
|
||
IF_SOME { | ||
SWAP; | ||
UNPAIR; SWAP; | ||
|
||
# create a ticket | ||
PUSH nat 10; | ||
SWAP; | ||
UNIT; | ||
PAIR; | ||
TICKET; | ||
ASSERT_SOME; | ||
PAIR; | ||
|
||
# amount for transfering | ||
PUSH mutez 0; | ||
SWAP; | ||
|
||
# deposit | ||
TRANSFER_TOKENS; | ||
|
||
DIP { NIL operation }; | ||
CONS; | ||
|
||
DIP { PUSH unit Unit }; | ||
PAIR; | ||
} | ||
{ FAIL ; } | ||
} | ||
`, | ||
storage: "Unit" | ||
}) | ||
await op.confirmation(); | ||
expect(op.hash).toBeDefined(); | ||
expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
|
||
const contract = await op.contract(); | ||
console.log(contract.address); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
|
||
const storage = await contract.storage(); | ||
expect(JSON.stringify(storage)).toEqual(JSON.stringify(UnitValue)); | ||
|
||
const ticketDeposit = await contract.methods.default(txRollupAddress, 'tz4VHgLiRx5ZZjwU2QaybHc11EMJk3NcyvVc', '1').send(); | ||
await ticketDeposit.confirmation(); | ||
|
||
expect(ticketDeposit.hash).toBeDefined(); | ||
expect(ticketDeposit.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
expect(JSON.stringify(await contract.storage())).toEqual(JSON.stringify(UnitValue)); | ||
done(); | ||
}) | ||
|
||
it(`Contract with params and storage as tx_rollup_l2_address`, async (done) => { | ||
const op = await tezos.contract.originate({ | ||
code: [{"prim":"parameter","args":[{"prim":"tx_rollup_l2_address"}]},{"prim":"storage","args":[{"prim":"tx_rollup_l2_address"}]},{"prim":"code","args":[[{"prim":"CAR"},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"PAIR"}]]}], | ||
code: [{ "prim": "parameter", "args": [{ "prim": "tx_rollup_l2_address" }] }, { "prim": "storage", "args": [{ "prim": "tx_rollup_l2_address" }] }, { "prim": "code", "args": [[{ "prim": "CAR" }, { "prim": "NIL", "args": [{ "prim": "operation" }] }, { "prim": "PAIR" }]] }], | ||
storage: "tz4QyWfEiv56CVDATV3DT3CDVhPaMKif2Ce8" | ||
}) | ||
await op.confirmation(); | ||
|
@@ -79,72 +145,13 @@ CONFIGS().forEach(({lib, setup, protocol, txRollupAddress}) => { | |
expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
|
||
const contract = await op.contract(); | ||
const pkh = await contract.storage() | ||
const pkh = await contract.storage(); | ||
expect(pkh).toEqual("tz4QyWfEiv56CVDATV3DT3CDVhPaMKif2Ce8"); | ||
|
||
const ticketDeposit = await contract.methods.default(pkh).send(); | ||
await ticketDeposit.confirmation(); | ||
expect(ticketDeposit.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY) | ||
expect(ticketDeposit.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
done(); | ||
}) | ||
}) | ||
|
||
// comment until possible to generate txr1 in test itself | ||
// mondaynet(`mondaynet Originate a contract with a hex string type tz1 & tz4 in initial storage tz4 & string`, async (done) => { | ||
// const op = await tezos.contract.originate({ | ||
// code: ` | ||
// parameter (pair address tx_rollup_l2_address string); | ||
// storage (unit); | ||
// code { | ||
// # cast the address to contract type | ||
// CAR; | ||
// UNPAIR; | ||
// CONTRACT %deposit (pair (ticket (pair unit string)) tx_rollup_l2_address); | ||
|
||
// IF_SOME { | ||
// SWAP; | ||
// UNPAIR; SWAP; | ||
|
||
// # create a ticket | ||
// PUSH nat 10; | ||
// SWAP; | ||
// UNIT; | ||
// PAIR; | ||
// TICKET; | ||
// PAIR; | ||
|
||
// # amount for transfering | ||
// PUSH mutez 0; | ||
// SWAP; | ||
|
||
// # deposit | ||
// TRANSFER_TOKENS; | ||
|
||
// DIP { NIL operation }; | ||
// CONS; | ||
|
||
// DIP { PUSH unit Unit }; | ||
// PAIR; | ||
// } | ||
// { FAIL ; } | ||
// } | ||
// `, | ||
// storage: "Unit" | ||
// }) | ||
// await op.confirmation(); | ||
// expect(op.hash).toBeDefined(); | ||
// expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
|
||
// const contract = await op.contract(); | ||
// const symbolReturn = await contract.storage() | ||
// expect(JSON.stringify(symbolReturn)).toEqual(JSON.stringify(UnitValue)) | ||
// const methodCall = await contract.methods.default('txr1kXEJHuy7xiJ2fTPWxf2yoNY5EZ6hzQXLM', 'tz4RVDZotqkdHGckMkZLB2mUkqAk8BRqz6Jn', '1').send(); | ||
// await methodCall.confirmation(); | ||
|
||
// expect(methodCall.hash).toBeDefined(); | ||
// expect(methodCall.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
// expect(JSON.stringify(await contract.storage())).toEqual(JSON.stringify(UnitValue)) | ||
// done(); | ||
// }) | ||
|
||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this console log was left in by accident
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oop thanks