From f7a0921bb4bb26a3abba9c298a7f50e49248d711 Mon Sep 17 00:00:00 2001 From: Facundo Date: Thu, 13 Jun 2024 00:43:24 +0100 Subject: [PATCH] chore(avm): remove unused public context inputs (#7028) Part of #5818. --------- Co-authored-by: ludamad --- scripts/earthly-ci | 24 +++++++---- .../structs/context/public_context_inputs.ts | 40 ------------------- yarn-project/circuits.js/src/structs/index.ts | 1 - 3 files changed, 16 insertions(+), 49 deletions(-) delete mode 100644 yarn-project/circuits.js/src/structs/context/public_context_inputs.ts diff --git a/scripts/earthly-ci b/scripts/earthly-ci index 0cbc5846205..c2ae10b529a 100755 --- a/scripts/earthly-ci +++ b/scripts/earthly-ci @@ -23,6 +23,16 @@ export GITHUB_ACTIONS=true export FORCE_COLOR=1 export EARTHLY_CONFIG=$(git rev-parse --show-toplevel)/.github/earthly-ci-config.yml +function wipe_non_cache_docker_state { + echo "Detected corrupted docker images. Wiping and trying again." + # Based on https://stackoverflow.com/a/75849307 + # wipe everything but volumes where we have earthly cache + sudo service docker stop + sudo bash -c 'rm -rf /var/lib/docker/{buildkit,containers,image,network,overlay2,plugins.runtimes,swarm,tmp,trust}/*' + # restart docker - might take down builds, but we need to recover anyway + sudo service docker restart +} + # Handle earthly commands and retries while [ $ATTEMPT_COUNT -lt $MAX_ATTEMPTS ]; do if earthly $@ 2>&1 | tee $OUTPUT_FILE >&2 ; then @@ -49,16 +59,14 @@ while [ $ATTEMPT_COUNT -lt $MAX_ATTEMPTS ]; do echo "Detected earthly unable to find buildkit, waiting and trying again..." sleep 20 elif grep 'The container name "/earthly-buildkitd" is already in use by container' $OUTPUT_FILE >/dev/null; then - echo "Detected earthly bootstrap happening in parallel and failing, waiting and trying again." + if [ $ATTEMPT_COUNT -lt 3 ] ; then + echo "Detected earthly bootstrap happening in parallel and failing, waiting and trying again." + else + wipe_non_cache_docker_state + fi sleep 20 elif grep 'status 125: docker: Error response from daemon: layer does not exist.' $OUTPUT_FILE >/dev/null || grep 'could not determine buildkit address - is Docker or Podman running?' $OUTPUT_FILE >/dev/null ; then - echo "Detected corrupted docker images. Wiping and trying again." - # Based on https://stackoverflow.com/a/75849307 - # wipe everything but volumes where we have earthly cache - sudo service docker stop - sudo bash -c 'rm -rf /var/lib/docker/{buildkit,containers,image,network,overlay2,plugins.runtimes,swarm,tmp,trust}/*' - # restart docker - might take down builds, but we need to recover anyway - sudo service docker restart + wipe_non_cache_docker_state # wait for other docker restarts sleep 20 else diff --git a/yarn-project/circuits.js/src/structs/context/public_context_inputs.ts b/yarn-project/circuits.js/src/structs/context/public_context_inputs.ts deleted file mode 100644 index 567c3d09027..00000000000 --- a/yarn-project/circuits.js/src/structs/context/public_context_inputs.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Fr } from '@aztec/foundation/fields'; -import { serializeToFields } from '@aztec/foundation/serialize'; - -import { CallContext } from '../call_context.js'; -import { Gas } from '../gas.js'; -import { GlobalVariables } from '../global_variables.js'; -import { Header } from '../header.js'; - -export class PublicContextInputs { - constructor( - public callContext: CallContext, - public historicalHeader: Header, - public publicGlobalVariables: GlobalVariables, - public startSideEffectCounter: number, - public gasLeft: Gas, - public transactionFee: Fr, - ) {} - - public static empty(): PublicContextInputs { - return new PublicContextInputs( - CallContext.empty(), - Header.empty(), - GlobalVariables.empty(), - 0, - Gas.empty(), - Fr.ZERO, - ); - } - - public toFields() { - return serializeToFields([ - this.callContext, - this.historicalHeader, - this.publicGlobalVariables, - this.startSideEffectCounter, - this.gasLeft, - this.transactionFee, - ]); - } -} diff --git a/yarn-project/circuits.js/src/structs/index.ts b/yarn-project/circuits.js/src/structs/index.ts index ae78be4382b..c8bf5154dc5 100644 --- a/yarn-project/circuits.js/src/structs/index.ts +++ b/yarn-project/circuits.js/src/structs/index.ts @@ -6,7 +6,6 @@ export * from './caller_context.js'; export * from './complete_address.js'; export * from './content_commitment.js'; export * from './context/private_context_inputs.js'; -export * from './context/public_context_inputs.js'; export * from './contract_storage_read.js'; export * from './contract_storage_update_request.js'; export * from './function_data.js';