Skip to content

Commit

Permalink
Fix according to review
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Rey committed May 10, 2024
1 parent 6525ad7 commit ae001cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { BlockchainClient } from '../client'
import { Signature } from './signature'
import varint from 'varint'
import { FIRST } from '../utils'

// TODO: replace with a U64 helper
const U64_SIZE_BYTES = 8
import { U64 } from './serializers'

const PERIOD_TO_LIVE_DEFAULT = 10
const PERIOD_TO_LIVE_MAX = 100
Expand Down Expand Up @@ -103,7 +101,6 @@ export class OperationManager {
* @returns A byte array representing the serialized operation.
*/
static serialize(operation: OperationDetails): Uint8Array {
// TODO: check that unsigned.encode is equivalent to varint.encode
const components = [
unsigned.encode(operation.fee),
varint.encode(operation.expirePeriod),
Expand Down Expand Up @@ -227,7 +224,7 @@ export class OperationManager {
key: PublicKey
): Uint8Array {
// u64ToBytes is little endian
const networkId = new Uint8Array(U64_SIZE_BYTES)
const networkId = new Uint8Array(U64.SIZE_BYTE)
const view = new DataView(networkId.buffer)
view.setBigUint64(FIRST, chainId, false)

Expand Down
6 changes: 2 additions & 4 deletions packages/massa-web3/src/experimental/basicElements/storage.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { toNanoMas } from '../utils'
import { U32 } from './serializers'

const BYTE_COST_MASSA = 0.0001

// TODO: replace with a U32 helper
const U32_SIZE_BYTES = 4

// TODO: replace by the underlying logic of the storage cost
const ACCOUNT_SIZE_BYTES = 10

Expand Down Expand Up @@ -48,5 +46,5 @@ export function smartContract(numberOfBytes: number): bigint {
* @returns The cost in the smallest unit of the Massa currency.
*/
export function newEntry(): bigint {
return bytes(U32_SIZE_BYTES)
return bytes(U32.SIZE_BYTE)
}

0 comments on commit ae001cc

Please sign in to comment.