-
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
2065 local forging support new operations for lima #2106
Changes from 29 commits
47cf160
53bf5c5
eddeb1d
ac9bd70
ca9577d
8c1643d
d34128b
ad53532
1d175f5
b1414ef
c029847
33489db
029efa1
2992fcf
edd3f63
e0126e5
984e3a5
1c0a203
db4db3d
b2f4a98
3f0723c
501b4b2
2e9ceba
4070a28
d978b87
64903a8
6628b93
5b73497
dbc38dc
9c71ca0
f3761d5
db7ece5
7965eb0
cc7dc6d
431c646
82143fd
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,16 +1,81 @@ | ||
import { CONFIGS } from "./config"; | ||
import { ticketCode, ticketStorage } from './data/code_with_ticket'; | ||
import { ticketCodeProto14, ticketStorageProto14 } from './data/code_with_ticket_proto14'; | ||
import { Protocols } from "@taquito/taquito"; | ||
|
||
CONFIGS().forEach(({ lib, rpc, setup }) => { | ||
CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { | ||
const Tezos = lib; | ||
const kathmandunet = protocol === Protocols.PtKathman ? test: test.skip; | ||
const limanetAndAlpha = protocol === Protocols.PtLimaPtL || protocol === Protocols.ProtoALpha ? test: test.skip; | ||
|
||
describe(`Test origination of a token contract using: ${rpc}`, () => { | ||
|
||
beforeEach(async (done) => { | ||
await setup(); | ||
done() | ||
}) | ||
test('Originates a contract having ticket with init and the wallet api', async (done) => { | ||
kathmandunet('Originates a contract having ticket with init and the wallet api', async (done) => { | ||
const op = await Tezos.wallet.originate({ | ||
code: ticketCodeProto14, | ||
init: ticketStorageProto14 | ||
}).send(); | ||
|
||
await op.confirmation(); | ||
expect(op.opHash).toBeDefined(); | ||
|
||
done(); | ||
}); | ||
|
||
kathmandunet('Originates a contract having ticket with init and the contract api', async (done) => { | ||
const op = await Tezos.contract.originate({ | ||
code: ticketCodeProto14, | ||
init: `(Pair None None)` | ||
}); | ||
|
||
await op.confirmation(); | ||
expect(op.hash).toBeDefined(); | ||
expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
|
||
done(); | ||
}); | ||
|
||
kathmandunet('Originates a contract having ticket with init in JSON and the contract api', async (done) => { | ||
const op = await Tezos.contract.originate({ | ||
code: ticketCodeProto14, | ||
init: { prim: 'Pair', args: [ { prim: 'None' }, { prim: 'None' } ] } | ||
}); | ||
|
||
await op.confirmation(); | ||
expect(op.hash).toBeDefined(); | ||
expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
|
||
done(); | ||
}); | ||
|
||
kathmandunet('Originates a contract having ticket with storage and the contract api', async (done) => { | ||
const op = await Tezos.contract.originate({ | ||
code: ticketCodeProto14, | ||
storage: { | ||
'%x': null, | ||
'%y': null | ||
} | ||
}); | ||
|
||
await op.confirmation(); | ||
expect(op.hash).toBeDefined(); | ||
expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); | ||
|
||
done(); | ||
}); | ||
}); | ||
|
||
describe(`Test origination of a token contract using: ${rpc}`, () => { | ||
|
||
beforeEach(async (done) => { | ||
await setup(); | ||
done() | ||
}) | ||
limanetAndAlpha('Originates a contract having ticket with init and the wallet api', async (done) => { | ||
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 for this one that seems to be duplicated in integration-tests/wallet-edo-deploy-having-ticket.spec.ts |
||
const op = await Tezos.wallet.originate({ | ||
code: ticketCode, | ||
init: ticketStorage | ||
|
@@ -22,7 +87,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { | |
done(); | ||
}); | ||
|
||
test('Originates a contract having ticket with init and the contract api', async (done) => { | ||
limanetAndAlpha('Originates a contract having ticket with init and the contract api', async (done) => { | ||
const op = await Tezos.contract.originate({ | ||
code: ticketCode, | ||
init: `(Pair None None)` | ||
|
@@ -35,7 +100,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { | |
done(); | ||
}); | ||
|
||
test('Originates a contract having ticket with init in JSON and the contract api', async (done) => { | ||
limanetAndAlpha('Originates a contract having ticket with init in JSON and the contract api', async (done) => { | ||
const op = await Tezos.contract.originate({ | ||
code: ticketCode, | ||
init: { prim: 'Pair', args: [ { prim: 'None' }, { prim: 'None' } ] } | ||
|
@@ -48,7 +113,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { | |
done(); | ||
}); | ||
|
||
test('Originates a contract having ticket with storage and the contract api', async (done) => { | ||
limanetAndAlpha('Originates a contract having ticket with storage and the contract api', async (done) => { | ||
const op = await Tezos.contract.originate({ | ||
code: ticketCode, | ||
storage: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,16 +8,17 @@ import { | |
example9, | ||
example10, | ||
} from './code_with_sapling'; | ||
import { ticketCode, ticketStorage } from './code_with_ticket'; | ||
import { | ||
ticketCode, | ||
ticketCode2, | ||
ticketCode3, | ||
ticketCode4, | ||
ticketStorage, | ||
ticketStorage2, | ||
ticketStorage3, | ||
ticketStorage4, | ||
} from './code_with_ticket'; | ||
ticketCodeProto14, | ||
ticketCode2Proto14, | ||
ticketCode3Proto14, | ||
ticketCode4Proto14, | ||
ticketStorageProto14, | ||
ticketStorage2Proto14, | ||
ticketStorage3Proto14, | ||
ticketStorage4Proto14, | ||
} from './code_with_ticket_proto14'; | ||
import { genericCode, genericStorage } from './generic_contract'; | ||
import { tokenBigmapCode, tokenBigmapStorage } from './token_bigmap'; | ||
import { noAnnotCode, noAnnotInit } from './token_without_annotation'; | ||
|
@@ -30,6 +31,7 @@ import { | |
import { codeViewsTopLevel, storageViewsTopLevel } from './contract_views_top_level'; | ||
import { MichelsonV1Expression, OpKind } from '@taquito/rpc'; | ||
import { emitCode } from './code_with_emit'; | ||
import { opMappingProto14 } from '../../packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14' | ||
|
||
function extractOp( | ||
startIndex: number, | ||
|
@@ -804,7 +806,7 @@ export const commonCases: TestCase[] = [ | |
], | ||
}, | ||
}, | ||
...extractOp(0, 150, opMapping).map((op): TestCase => { | ||
...extractOp(0, 150, opMappingProto14).map((op): TestCase => { | ||
return { | ||
name: `Origination operation (${op})`, | ||
operation: { | ||
|
@@ -941,8 +943,8 @@ export const commonCases: TestCase[] = [ | |
storage_limit: '10', | ||
balance: '0', | ||
script: { | ||
code: ticketCode, | ||
storage: ticketStorage, | ||
code: ticketCodeProto14, | ||
storage: ticketStorageProto14, | ||
}, | ||
}, | ||
], | ||
|
@@ -962,8 +964,8 @@ export const commonCases: TestCase[] = [ | |
storage_limit: '10', | ||
balance: '0', | ||
script: { | ||
code: ticketCode2, | ||
storage: ticketStorage2, | ||
code: ticketCode2Proto14, | ||
storage: ticketStorage2Proto14, | ||
}, | ||
}, | ||
], | ||
|
@@ -983,8 +985,8 @@ export const commonCases: TestCase[] = [ | |
storage_limit: '10', | ||
balance: '0', | ||
script: { | ||
code: ticketCode3, | ||
storage: ticketStorage3, | ||
code: ticketCode3Proto14, | ||
storage: ticketStorage3Proto14, | ||
}, | ||
}, | ||
], | ||
|
@@ -1004,8 +1006,8 @@ export const commonCases: TestCase[] = [ | |
storage_limit: '10', | ||
balance: '0', | ||
script: { | ||
code: ticketCode4, | ||
storage: ticketStorage4, | ||
code: ticketCode4Proto14, | ||
storage: ticketStorage4Proto14, | ||
}, | ||
}, | ||
], | ||
|
@@ -1345,7 +1347,7 @@ export const commonCases: TestCase[] = [ | |
]; | ||
|
||
export const kathmanduCases: TestCase[] = [ | ||
...extractOp(150, 151, opMapping).map((op): TestCase => { | ||
...extractOp(150, 151, opMappingProto14).map((op): TestCase => { | ||
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. Can we move the following tests:
|
||
return { | ||
name: `Origination operation (${op})`, | ||
operation: { | ||
|
@@ -1410,3 +1412,83 @@ export const kathmanduCases: TestCase[] = [ | |
}, | ||
}, | ||
]; | ||
|
||
|
||
export const limaCases: TestCase[] = [ | ||
// In `opMapping` from the file `constants.ts`, the operations and types starting at `ticket` were added in the lima protocol | ||
...extractOp(154, 154, opMapping).map((op): TestCase => { | ||
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. Can we test from 152 to 154 to include lambda_rec as well? |
||
return { | ||
name: `Origination operation (${op})`, | ||
operation: { | ||
branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', | ||
contents: [ | ||
{ | ||
kind: OpKind.ORIGINATION, | ||
counter: '1', | ||
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', | ||
fee: '10000', | ||
gas_limit: '10', | ||
storage_limit: '10', | ||
balance: '0', | ||
script: { | ||
code: genericCode(op) as MichelsonV1Expression[], | ||
storage: genericStorage, | ||
}, | ||
}, | ||
], | ||
}, | ||
}; | ||
}), | ||
{ | ||
name: `Origination of a contract that contains the instructions TICKET`, | ||
operation: { | ||
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL', | ||
contents: [ | ||
{ | ||
kind: OpKind.ORIGINATION, | ||
counter: '94141', | ||
source: 'tz2WH1zahKo2KiS1gcHBhNFTURPfW1Vk7qpE', | ||
fee: '603', | ||
gas_limit: '1526', | ||
storage_limit: '377', | ||
balance: '0', | ||
script: { | ||
code: ticketCode, | ||
storage: ticketStorage, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
name: `Update Consensus Key operation`, | ||
operation: { | ||
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL', | ||
contents: [ | ||
{ | ||
kind: OpKind.UPDATE_CONSENSUS_KEY, | ||
counter: '1', | ||
source: 'tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj', | ||
fee: '100', | ||
gas_limit: '10000', | ||
storage_limit: '10', | ||
pk: 'edpkti5K5JbdLpp2dCqiTLoLQqs5wqzeVhfHVnNhsSCuoU8zdHYoY7' | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
name: `Drain Delegate operation`, | ||
operation: { | ||
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL', | ||
contents: [ | ||
{ | ||
kind: OpKind.DRAIN_DELEGATE, | ||
consensus_key: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv', | ||
delegate: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv', | ||
destination: 'tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj', | ||
}, | ||
], | ||
}, | ||
}, | ||
]; |
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 specific test is duplicated from "integration-tests/wallet-edo-deploy-having-ticket.spec.ts". Can it be removed?