metaplex-foundation / metaplex-program-library

Smart contracts maintained by the Metaplex team
Other
580 stars 510 forks source link

Make candy machine clock an unchecked account #659

Closed stegaBOB closed 1 year ago

stegaBOB commented 2 years ago

The clock account is unused. It currently takes up compute and txn size by including it in the transaction. Save space and compute by replacing it with an unchecked account

ohaddahan commented 1 year ago

The clock account is unused. It currently takes up compute and txn size by including it in the transaction. Save space and compute by replacing it with an unchecked account

What do you mean? Seems like it's used only in mint.rs and can't be removed there.

candy-machine/program/src/processor/mint.rs:    clock::Clock,
candy-machine/program/src/processor/mint.rs:    clock: Sysvar<'info, Clock>,
candy-machine/program/src/processor/mint.rs:    let clock = Clock::get()?;
candy-machine/program/src/processor/mint.rs:                if clock.unix_timestamp > es.number as i64
candy-machine/program/src/processor/mint.rs:                            if clock.unix_timestamp < val
candy-machine/program/src/processor/mint.rs:                    let go_live = assert_valid_go_live(payer, &clock, candy_machine);
candy-machine/program/src/processor/mint.rs:                let go_live = assert_valid_go_live(payer, &clock, candy_machine);
candy-machine/program/src/processor/mint.rs:        let go_live = assert_valid_go_live(payer, &clock, candy_machine);
candy-machine/program/src/processor/mint.rs:                if freeze_pda.thaw_eligible(clock.unix_timestamp, candy_machine) {
candy-machine/program/src/processor/mint.rs:                if freeze_pda.thaw_eligible(clock.unix_timestamp, candy_machine) {
candy-machine/program/src/processor/mint.rs:            freeze_pda.mint_start = Some(clock.unix_timestamp);
candy-machine/program/src/utils.rs:    clock::Clock,
candy-machine/program/src/utils.rs:    clock: &Clock,
candy-machine/program/src/utils.rs:            if clock.unix_timestamp < val && !cmp_pubkeys(payer.key, &candy_machine.authority) {
austbot commented 1 year ago

think this is not needed?