Skip to content

updated CI to use a stable toolchain - #1

Merged
phertyameen merged 2 commits into
mainfrom
setup
Jan 15, 2026
Merged

phertyameen merged 2 commits into
mainfrom
setup

Conversation

@phertyameen

Copy link
Copy Markdown
Contributor

No description provided.

@phertyameen
phertyameen merged commit ba97bff into main Jan 15, 2026
1 check passed
nanaf6203-bit added a commit to nanaf6203-bit/bridgelet-core that referenced this pull request Jul 24, 2026
…tests, accurate reentrancy doc

Closes bridgelet-org#239
Closes bridgelet-org#240
Closes bridgelet-org#241
Closes bridgelet-org#242

Addressing the four open issues assigned to @nanaf6203-bit:

bridgelet-org#240 (CRITICAL) account_factory::initialize had no auth and no
already-initialized guard. New initialize(env, creator, wasm_hash) ->
Result<(), Error>; storage-state check runs first, then creator.require_auth(),
then writes the hash and seeds BatchNonce = 0. New
contracts/account_factory/src/errors.rs with Error enum (AlreadyInitialized =
1, NotInitialized = 2). Double-init now panics with Error(Contract, bridgelet-org#1) so
the WASM hash can no longer be silently overwritten. This is a deliberate
breaking change to initialize's signature: account_factory is described in
the project README as entirely undocumented and undeployed, and has no init
invocation in scripts/deploy-testnet.sh or in CI, so the new signature is
safe to ship.

bridgelet-org#241 (CRITICAL) batch_initialize deployment salt collided across calls.
Soroban derives a contract address from (factory_address, salt, wasm_hash),
so a salt that depended only on the per-batch index would collide on the
second call (the loop would again produce salt = [0...0 || index]).
DataKey::BatchNonce (u64) is bumped once per batch_initialize invocation.
Salt layout (BE, 32 bytes):

  [0..8]   nonce   monotonic u64
  [8..28]  zeros   reserved (forward compatibility)
  [28..32] index   per-request position inside the call

Guarantees: distinct calls yield disjoint address ranges even at the same
index; deterministic given (factory, nonce, index, wasm_hash).

bridgelet-org#242 (HIGH) account_factory's only test did not call batch_initialize and
did not assert anything. Replaced with seven real tests covering both bridgelet-org#240
and bridgelet-org#241: Result variant on double-init, front-running scenario, missing-auth
abort, should_panic(Error(Contract, bridgelet-org#1)), 3-request happy path with Active
status per deployed account plus intra-batch uniqueness, cross-call salt
uniqueness at the same index, monotonic nonce across 5 invocations.
Tests pull the real wasm hash via

  env.deployer().upload_contract_wasm(
    include_bytes!("../../../target/wasm32v1-none/release/ephemeral_account.wasm"))

and use env.register(EphemeralAccountContract, ()) for direct SDK calls.

bridgelet-org#239 (MEDIUM) docs/reentrancy-analysis.md overstated record_payment coverage.
Added an indirect AlreadySwept row to the summary table; rewrote the closing
sentence to accurately state: record_payment is not reentrancy-locked (no
AccountStatus read, no require_auth, accepts any caller); the only
reentrancy-style defense for the record_payment-then-sweep pattern is the
AlreadySwept guard inside the second sweep() call. Callers must authenticate
record_payment calls out-of-band; the contract does not enforce it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant