Skip to content

Commit

Permalink
Use 0x00... as valid cosigner
Browse files Browse the repository at this point in the history
  • Loading branch information
codyborn committed Nov 27, 2024
1 parent a85b806 commit 641673c
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions test/unit/util/order-validator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ describe('Testing off chain validation', () => {
const order = SDKDutchOrderV3Factory.buildDutchV3Order(ChainId.ARBITRUM_ONE, {
cosigner: process.env.LABS_COSIGNER
})
order.info.deadline = CURRENT_TIME + ONE_DAY;
order.info.deadline = CURRENT_TIME + ONE_DAY
const validationResp = validationProvider.validate(order)
expect(validationResp).toEqual({
valid: true
Expand All @@ -370,11 +370,13 @@ describe('Testing off chain validation', () => {

it('Should throw missing cosigner', () => {
const order = SDKDutchOrderV3Factory.buildDutchV3Order(ChainId.ARBITRUM_ONE)
order.info.deadline = CURRENT_TIME + ONE_DAY;
// Invalid cosigner
order.info.cosigner = '0x0000000000000000000000000000000000000001'
order.info.deadline = CURRENT_TIME + ONE_DAY
const validationResp = validationProvider.validate(order)
expect(validationResp).toEqual({
valid: false,
errorString: 'Invalid cosigner: ValidationError: "value" must be [0x4449Cd34d1eb1FEDCF02A1Be3834FfDe8E6A6180]',
errorString: 'Invalid cosigner: ValidationError: "value" must be [0x0000000000000000000000000000000000000000]',
})
})

Expand All @@ -388,9 +390,9 @@ describe('Testing off chain validation', () => {
},
},
})
order.info.deadline = CURRENT_TIME + ONE_DAY;
order.info.deadline = CURRENT_TIME + ONE_DAY
// Set to be empty
order.info.input.curve.relativeBlocks = [];
order.info.input.curve.relativeBlocks = []
const validationResp = validationProvider.validate(order)
expect(validationResp).toEqual({
valid: false,
Expand All @@ -409,8 +411,8 @@ describe('Testing off chain validation', () => {
},
})
// Set to be non increasing
order.info.input.curve.relativeBlocks = [1, 1];
order.info.deadline = CURRENT_TIME + ONE_DAY;
order.info.input.curve.relativeBlocks = [1, 1]
order.info.deadline = CURRENT_TIME + ONE_DAY
const validationResp = validationProvider.validate(order)
expect(validationResp).toEqual({
valid: false,
Expand All @@ -427,8 +429,8 @@ describe('Testing off chain validation', () => {
},
})
// Override with more than the startAmount
order.info.cosignerData.inputOverride = BigNumber.from('1000000000000000000');
order.info.deadline = CURRENT_TIME + ONE_DAY;
order.info.cosignerData.inputOverride = BigNumber.from('1000000000000000000')
order.info.deadline = CURRENT_TIME + ONE_DAY
const validationResp = validationProvider.validate(order)
expect(validationResp).toEqual({
valid: false,
Expand All @@ -449,9 +451,9 @@ describe('Testing off chain validation', () => {
},
]
})
order.info.deadline = CURRENT_TIME + ONE_DAY;
order.info.deadline = CURRENT_TIME + ONE_DAY
// Set to be empty
order.info.outputs[0].curve.relativeBlocks = [];
order.info.outputs[0].curve.relativeBlocks = []
const validationResp = validationProvider.validate(order)
expect(validationResp).toEqual({
valid: false,
Expand All @@ -472,8 +474,8 @@ describe('Testing off chain validation', () => {
],
})
// Set to be non increasing
order.info.outputs[0].curve.relativeBlocks = [2, 1];
order.info.deadline = CURRENT_TIME + ONE_DAY;
order.info.outputs[0].curve.relativeBlocks = [2, 1]
order.info.deadline = CURRENT_TIME + ONE_DAY
const validationResp = validationProvider.validate(order)
expect(validationResp).toEqual({
valid: false,
Expand All @@ -492,7 +494,7 @@ describe('Testing off chain validation', () => {
maxAmount: BigNumber.from(10),
},
})
order.info.deadline = CURRENT_TIME + ONE_DAY;
order.info.deadline = CURRENT_TIME + ONE_DAY
const validationResp = validationProvider.validate(order)
expect(validationResp).toEqual({
valid: false,
Expand All @@ -513,7 +515,7 @@ describe('Testing off chain validation', () => {
},
],
})
order.info.deadline = CURRENT_TIME + ONE_DAY;
order.info.deadline = CURRENT_TIME + ONE_DAY
const validationResp = validationProvider.validate(order)
expect(validationResp).toEqual({
valid: false,
Expand All @@ -532,8 +534,8 @@ describe('Testing off chain validation', () => {
]
})
// Override with less than the startAmount
order.info.cosignerData.outputOverrides = [BigNumber.from('99')];
order.info.deadline = CURRENT_TIME + ONE_DAY;
order.info.cosignerData.outputOverrides = [BigNumber.from('99')]
order.info.deadline = CURRENT_TIME + ONE_DAY
const validationResp = validationProvider.validate(order)
expect(validationResp).toEqual({
valid: false,
Expand Down

0 comments on commit 641673c

Please sign in to comment.