Fix oracle error patterns and oracle e2e tests (#585)
This commit is contained in:
parent
6e1f57493a
commit
5e95b5d8c5
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -205,7 +205,7 @@ jobs:
|
|||||||
- name: Login to docker registry
|
- name: Login to docker registry
|
||||||
run: docker login ${DOCKER_REGISTRY} -u ${{ github.actor }} -p ${{ github.token }}
|
run: docker login ${DOCKER_REGISTRY} -u ${{ github.actor }} -p ${{ github.token }}
|
||||||
- name: Deploy contracts
|
- name: Deploy contracts
|
||||||
run: ${{ steps.cache-repo.outputs.cache-hit }} && e2e-commons/up.sh deploy blocks
|
run: ${{ steps.cache-repo.outputs.cache-hit }} && e2e-commons/up.sh deploy generate-amb-tx blocks
|
||||||
- name: Pull e2e oracle image
|
- name: Pull e2e oracle image
|
||||||
run: |
|
run: |
|
||||||
docker-compose -f ./e2e-commons/docker-compose.yml pull oracle-amb
|
docker-compose -f ./e2e-commons/docker-compose.yml pull oracle-amb
|
||||||
|
@ -63,17 +63,19 @@ describe('arbitrary message bridging', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('Confirm Relay', () => {
|
if (process.env.ULTIMATE !== 'true') {
|
||||||
it('should process lost affirmation-request via confirm relay', async () => {
|
describe('Confirm Relay', () => {
|
||||||
const value = await homeBox.methods.value().call()
|
it('should process lost affirmation-request via confirm relay', async () => {
|
||||||
assert(value === '789', 'incorrect value')
|
const value = await homeBox.methods.value().call()
|
||||||
})
|
assert(value === '789', 'incorrect value')
|
||||||
|
})
|
||||||
|
|
||||||
it('should process lost signature-request & collected-signatures via confirm relay', async () => {
|
it('should process lost signature-request & collected-signatures via confirm relay', async () => {
|
||||||
const value = await foreignBox.methods.value().call()
|
const value = await foreignBox.methods.value().call()
|
||||||
assert(value === '123', 'incorrect value')
|
assert(value === '123', 'incorrect value')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
describe('Home to Foreign', () => {
|
describe('Home to Foreign', () => {
|
||||||
describe('Subsidized Mode', () => {
|
describe('Subsidized Mode', () => {
|
||||||
it('should bridge message', async () => {
|
it('should bridge message', async () => {
|
||||||
|
@ -14,7 +14,10 @@ const {
|
|||||||
waitForFunds,
|
waitForFunds,
|
||||||
waitForUnsuspend,
|
waitForUnsuspend,
|
||||||
watchdog,
|
watchdog,
|
||||||
nonceError
|
isGasPriceError,
|
||||||
|
isSameTransactionError,
|
||||||
|
isInsufficientBalanceError,
|
||||||
|
isNonceError
|
||||||
} = require('./utils/utils')
|
} = require('./utils/utils')
|
||||||
const { EXIT_CODES, EXTRA_GAS_PERCENTAGE, MAX_GAS_LIMIT } = require('./utils/constants')
|
const { EXIT_CODES, EXTRA_GAS_PERCENTAGE, MAX_GAS_LIMIT } = require('./utils/constants')
|
||||||
|
|
||||||
@ -189,12 +192,11 @@ async function main({ msg, ackMsg, nackMsg, channel, scheduleForRetry, scheduleT
|
|||||||
e.message
|
e.message
|
||||||
)
|
)
|
||||||
|
|
||||||
const message = e.message.toLowerCase()
|
if (isGasPriceError(e)) {
|
||||||
if (message.includes('replacement transaction underpriced')) {
|
|
||||||
logger.info('Replacement transaction underpriced, forcing gas price update')
|
logger.info('Replacement transaction underpriced, forcing gas price update')
|
||||||
GasPrice.start(config.id)
|
GasPrice.start(config.id)
|
||||||
failedTx.push(job)
|
failedTx.push(job)
|
||||||
} else if (isResend || message.includes('transaction with the same hash was already imported')) {
|
} else if (isResend || isSameTransactionError(e)) {
|
||||||
resendJobs.push(job)
|
resendJobs.push(job)
|
||||||
} else {
|
} else {
|
||||||
// if initial transaction sending has failed not due to the same hash error
|
// if initial transaction sending has failed not due to the same hash error
|
||||||
@ -203,14 +205,14 @@ async function main({ msg, ackMsg, nackMsg, channel, scheduleForRetry, scheduleT
|
|||||||
failedTx.push(job)
|
failedTx.push(job)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.includes('insufficient funds')) {
|
if (isInsufficientBalanceError(e)) {
|
||||||
insufficientFunds = true
|
insufficientFunds = true
|
||||||
const currentBalance = await web3.eth.getBalance(config.validatorAddress)
|
const currentBalance = await web3.eth.getBalance(config.validatorAddress)
|
||||||
minimumBalance = gasLimit.multipliedBy(gasPrice)
|
minimumBalance = gasLimit.multipliedBy(gasPrice)
|
||||||
logger.error(
|
logger.error(
|
||||||
`Insufficient funds: ${currentBalance}. Stop processing messages until the balance is at least ${minimumBalance}.`
|
`Insufficient funds: ${currentBalance}. Stop processing messages until the balance is at least ${minimumBalance}.`
|
||||||
)
|
)
|
||||||
} else if (nonceError(e)) {
|
} else if (isNonceError(e)) {
|
||||||
nonce = await readNonce(true)
|
nonce = await readNonce(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,22 @@ function privateKeyToAddress(privateKey) {
|
|||||||
return privateKey ? new Web3().eth.accounts.privateKeyToAccount(add0xPrefix(privateKey)).address : null
|
return privateKey ? new Web3().eth.accounts.privateKeyToAccount(add0xPrefix(privateKey)).address : null
|
||||||
}
|
}
|
||||||
|
|
||||||
function nonceError(e) {
|
function isGasPriceError(e) {
|
||||||
|
const message = e.message.toLowerCase()
|
||||||
|
return message.includes('replacement transaction underpriced')
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSameTransactionError(e) {
|
||||||
|
const message = e.message.toLowerCase()
|
||||||
|
return message.includes('transaction with the same hash was already imported') || message.includes('already known')
|
||||||
|
}
|
||||||
|
|
||||||
|
function isInsufficientBalanceError(e) {
|
||||||
|
const message = e.message.toLowerCase()
|
||||||
|
return message.includes('insufficient funds')
|
||||||
|
}
|
||||||
|
|
||||||
|
function isNonceError(e) {
|
||||||
const message = e.message.toLowerCase()
|
const message = e.message.toLowerCase()
|
||||||
return (
|
return (
|
||||||
message.includes('transaction nonce is too low') ||
|
message.includes('transaction nonce is too low') ||
|
||||||
@ -155,7 +170,10 @@ module.exports = {
|
|||||||
watchdog,
|
watchdog,
|
||||||
add0xPrefix,
|
add0xPrefix,
|
||||||
privateKeyToAddress,
|
privateKeyToAddress,
|
||||||
nonceError,
|
isGasPriceError,
|
||||||
|
isSameTransactionError,
|
||||||
|
isInsufficientBalanceError,
|
||||||
|
isNonceError,
|
||||||
getRetrySequence,
|
getRetrySequence,
|
||||||
promiseAny,
|
promiseAny,
|
||||||
readAccessListFile,
|
readAccessListFile,
|
||||||
|
Loading…
Reference in New Issue
Block a user