Method: Casper::Entity::DeployService#deploy_body_hash

Defined in:
lib/entity/deploy.rb

#deploy_body_hash(payment, session) ⇒ String

Compute body hash

Returns:

  • (String)


105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/entity/deploy.rb', line 105

def deploy_body_hash(payment, session)
  # puts  "Deploy::deploy_body_hash is called"
  if payment != nil && session != nil
    payment_serializer = DeployExecutable.new(payment)
    payment_byte_array = payment_serializer.to_bytes
    # puts payment_serializer.module_bytes?
    # puts payment_serializer.module_bytes
    # puts payment_serializer.module_bytes.get_args

    session_serializer = DeployExecutable.new(session)
    session_byte_array = session_serializer.to_bytes
    arr = payment_byte_array.concat(session_byte_array)
    hex = Utils::ByteUtils.byte_array_to_hex(arr)
    # puts "body_serializer:"
    # puts Utils::ByteUtils.byte_array_to_hex(arr)
    len = 32
    key = Blake2b::Key.none
    Blake2b.hex(hex, key, len)
    @body_hash = "42751eb696c9ed4d11715f03fe8e053065ce671991d808b6870e2a1e49fe356c"
  end
end